mirror of
https://github.com/acid-info/free.technology.git
synced 2025-02-23 06:58:16 +00:00
ci: fix Jenkinsfile, remove unnecessary credentials
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
f31f6e8322
commit
39811759f7
66
Jenkinsfile
vendored
66
Jenkinsfile
vendored
@ -19,7 +19,8 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
IMAGE_NAME = 'statusteam/ift'
|
IMAGE_NAME = 'statusteam/free-technology'
|
||||||
|
NEXT_PUBLIC_SITE_URL = "https://${env.JOB_BASE_NAME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
@ -27,19 +28,14 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
usernamePassword(),
|
|
||||||
string(
|
string(
|
||||||
credentialsId: 'ift-simplecast-token',
|
credentialsId: 'free-technology-github-token',
|
||||||
variable: 'SIMPLECAST_ACCESS_TOKEN'
|
variable: 'NEXT_GITHUB_PERSONAL_ACCESS_TOKEN'
|
||||||
),
|
|
||||||
string(
|
|
||||||
credentialsId: 'ift-webhook-token',
|
|
||||||
variable: 'REVALIDATE_WEBHOOK_TOKEN'
|
|
||||||
),
|
),
|
||||||
]) {
|
]) {
|
||||||
image = docker.build(
|
image = docker.build(
|
||||||
"${IMAGE_NAME}:${GIT_COMMIT.take(8)}",
|
"${IMAGE_NAME}:${GIT_COMMIT.take(8)}",
|
||||||
["--build-arg='REVALIDATE_WEBHOOK_TOKEN=${REVALIDATE_WEBHOOK_TOKEN}'",
|
["--build-arg='NEXT_GITHUB_PERSONAL_ACCESS_TOKEN=${NEXT_GITHUB_PERSONAL_ACCESS_TOKEN}'",
|
||||||
"."].join(' ')
|
"."].join(' ')
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -49,9 +45,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Push') {
|
stage('Push') {
|
||||||
steps { script {
|
steps { script {
|
||||||
withDockerRegistry([
|
withDockerRegistry([credentialsId: 'dockerhub-statusteam-auto', url: '']) {
|
||||||
credentialsId: 'dockerhub-statusteam-auto', url: ''
|
|
||||||
]) {
|
|
||||||
image.push()
|
image.push()
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
@ -60,9 +54,7 @@ pipeline {
|
|||||||
stage('Deploy') {
|
stage('Deploy') {
|
||||||
when { expression { params.IMAGE_TAG != '' } }
|
when { expression { params.IMAGE_TAG != '' } }
|
||||||
steps { script {
|
steps { script {
|
||||||
withDockerRegistry([
|
withDockerRegistry([credentialsId: 'dockerhub-statusteam-auto', url: '']) {
|
||||||
credentialsId: 'dockerhub-statusteam-auto', url: ''
|
|
||||||
]) {
|
|
||||||
image.push(params.IMAGE_TAG)
|
image.push(params.IMAGE_TAG)
|
||||||
}
|
}
|
||||||
} }
|
} }
|
||||||
@ -71,49 +63,5 @@ pipeline {
|
|||||||
|
|
||||||
post {
|
post {
|
||||||
cleanup { cleanWs() }
|
cleanup { cleanWs() }
|
||||||
always { script {
|
|
||||||
def result = currentBuild.result.toLowerCase() ?: 'unknown'
|
|
||||||
discordNotify(header: "IFT Docker image build ${result}!")
|
|
||||||
} }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def discordNotify(Map args=[:]) {
|
|
||||||
def opts = [
|
|
||||||
header: args.header ?: 'Deployment successful!',
|
|
||||||
title: args.title ?: "${env.JOB_NAME}#${env.BUILD_NUMBER}",
|
|
||||||
cred: args.cred ?: 'ift-discord-webhook-url',
|
|
||||||
]
|
|
||||||
def repo = [
|
|
||||||
url: GIT_URL.minus('.git'),
|
|
||||||
branch: GIT_BRANCH.minus('origin/'),
|
|
||||||
commit: GIT_COMMIT.take(8),
|
|
||||||
prev: (
|
|
||||||
env.GIT_PREVIOUS_SUCCESSFUL_COMMIT ?: env.GIT_PREVIOUS_COMMIT ?: 'master'
|
|
||||||
).take(8),
|
|
||||||
]
|
|
||||||
wrap([$class: 'BuildUser']) {
|
|
||||||
BUILD_USER_ID = env.BUILD_USER_ID
|
|
||||||
}
|
|
||||||
withCredentials([
|
|
||||||
string(
|
|
||||||
credentialsId: opts.cred,
|
|
||||||
variable: 'DISCORD_WEBHOOK',
|
|
||||||
),
|
|
||||||
]) {
|
|
||||||
discordSend(
|
|
||||||
link: env.BUILD_URL,
|
|
||||||
result: currentBuild.currentResult,
|
|
||||||
webhookURL: env.DISCORD_WEBHOOK,
|
|
||||||
title: opts.title,
|
|
||||||
description: """
|
|
||||||
${opts.header}
|
|
||||||
Image: [`${env.IMAGE_NAME}:${params.IMAGE_TAG}`](https://hub.docker.com/r/${params.DOCKER_NAME}/tags?name=${params.IMAGE_TAG})
|
|
||||||
Branch: [`${repo.branch}`](${repo.url}/commits/${repo.branch})
|
|
||||||
Commit: [`${repo.commit}`](${repo.url}/commit/${repo.commit})
|
|
||||||
Diff: [`${repo.prev}...${repo.commit}`](${repo.url}/compare/${repo.prev}...${repo.commit})
|
|
||||||
By: [`${BUILD_USER_ID}`](${repo.url}/commits?author=${BUILD_USER_ID})
|
|
||||||
""",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user