-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/v7.2.2' into 'master'
Release 7.2.2 See merge request megachat/MEGAchat!2029
- Loading branch information
Showing
6 changed files
with
404 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
pipeline { | ||
agent { label 'docker' } | ||
|
||
options { | ||
buildDiscarder(logRotator(numToKeepStr: '25', daysToKeepStr: '30')) | ||
gitLabConnection('GitLabConnectionJenkins') | ||
} | ||
parameters { | ||
choice(name: 'ACTION', choices: ['Create_Release', 'Create_Release_Candidate', 'Close_Release', 'Patch_Release'], description: 'Pick an action') | ||
string(name: 'SLACK_THREAD_ANNOUNCE', defaultValue: '', description: 'Id of thread root message') | ||
string(name: 'TARGET_APPS', defaultValue: '', description: 'e.g. Android 1.0.1 / iOS 1.2 / MEGAsync 9.9.9 RC1') | ||
string(name: 'RELEASE_VERSION', defaultValue: '', description: 'Optionally define a release version for Create Release. It must exist for Patch Release. Default is 1.0.0.') | ||
string(name: 'TICKETS', defaultValue: '', description: 'Comma separated tickets (patch release or create rc)') | ||
string(name: 'BRANCH_FOR_MR', defaultValue: '', description: 'Branch for MR (create release candidate)') | ||
string(name: 'MR_DESCRIPTION', defaultValue: '', description: 'MR Description (create release candidate)') | ||
password(name: 'GPG_PASSWORD', defaultValue: '', description: 'Enter the password') | ||
booleanParam(name: 'REBUILD_IMAGE', defaultValue: false, description: 'Rebuild docker image. Only needed if the scripts has been modified') | ||
} | ||
environment { | ||
SDK_BRANCH = "develop" | ||
SLACK_TOKEN = credentials('sdk_slack_bot_releases') | ||
GITLAB_TOKEN = credentials('SDK_releases_gitlab_token') | ||
GPG_KEYGRIP = credentials('sdk_gpg_keygrip_release_management') | ||
gpg_key = credentials('sdk_gpg_key_release_management') | ||
GITHUB_TOKEN = credentials('sdk_github_token') | ||
GITHUB_USER = credentials('sdk_github_username') | ||
project_name = "MEGAchat" | ||
slack_channel = "megachat_native" | ||
slack_channel_dev_requests = "sdk_devs_only" | ||
gitlab_url = "${env.GITLAB_BASE_URL}" | ||
jira_url = "${env.JIRA_BASE_URL}" | ||
confluence_url = "${env.CONFLUENCE_BASE_URL}" | ||
confluence_page_id = "3640225" | ||
github_push_remote_url = "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/meganz/MEGAchat.git" | ||
GNUPGHOME = "${WORKSPACE}/.gnupg" | ||
JIRA_TOKEN = credentials('SDK_JIRA_PERSONAL_ACCESS_TOKEN') | ||
CONFLUENCE_TOKEN = credentials('SDK_CONFLUENCE_PERSONAL_ACCESS_TOKEN') | ||
} | ||
|
||
stages { | ||
stage('Checkout SDK'){ | ||
steps{ | ||
dir('third-party/mega'){ | ||
checkout([ | ||
$class: 'GitSCM', | ||
branches: [[name: "origin/${SDK_BRANCH}"]], | ||
userRemoteConfigs: [[ url: "${env.GIT_URL_SDK}", credentialsId: "12492eb8-0278-4402-98f0-4412abfb65c1" ]], | ||
extensions: [ | ||
[$class: "UserIdentity",name: "jenkins", email: "jenkins@jenkins"] | ||
] | ||
]) | ||
} | ||
} | ||
} | ||
stage('Replace config file'){ | ||
steps { | ||
dir("third-party/mega/automation"){ | ||
sh 'cp config.toml.template config.toml' | ||
script { | ||
sh """ | ||
sed -i 's|project_name = ""|project_name = "${env.project_name}"|' config.toml | ||
sed -i 's|target_apps = ""|target_apps = "${params.TARGET_APPS}"|' config.toml | ||
sed -i 's|gitlab_url = ""|gitlab_url = "${env.gitlab_url}"|' config.toml | ||
sed -i 's|jira_url = ""|jira_url = "${env.jira_url}"|' config.toml | ||
sed -i 's|slack_channel_dev_requests = ""|slack_channel_dev_requests = "${env.slack_channel_dev_requests}"|' config.toml | ||
sed -i 's|slack_channel_announce = ""|slack_channel_announce = "${env.slack_channel}"|' config.toml | ||
sed -i 's|slack_thread_announce = ""|slack_thread_announce = "${params.SLACK_THREAD_ANNOUNCE}"|' config.toml | ||
sed -i 's|release_version = ""|release_version = "${params.RELEASE_VERSION}"|' config.toml | ||
sed -i 's|github_push_remote_url = ""|github_push_remote_url = "${env.github_push_remote_url}"|' config.toml | ||
sed -i 's|confluence_url = ""|confluence_url = "${env.confluence_url}"|' config.toml | ||
sed -i 's|tickets = ""|tickets = "${params.TICKETS}"|' config.toml | ||
sed -i 's|branch_for_mr = ""|branch_for_mr = "${params.BRANCH_FOR_MR}"|' config.toml | ||
sed -i 's|mr_description = ""|mr_description = "${params.MR_DESCRIPTION}"|' config.toml | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
stage('Build docker image') { | ||
when { | ||
beforeAgent true | ||
expression { return params.REBUILD_IMAGE } | ||
} | ||
steps { | ||
dir ("third-party/mega/dockerfile") { | ||
sh "cp -v ../automation/requirements.txt requirements.txt" | ||
sh """ | ||
docker build \ | ||
-f release-management.dockerfile \ | ||
-t ${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest \ | ||
. | ||
""" | ||
} | ||
withCredentials([usernamePassword(credentialsId: 'artifactory-jenkins-docker', usernameVariable: 'ART_USER', passwordVariable: 'ART_PASS')]) { | ||
sh """ | ||
echo \$ART_PASS | docker login \ | ||
-u \$ART_USER \ | ||
--password-stdin \ | ||
${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443 | ||
docker push ${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest | ||
""" | ||
} | ||
} | ||
} | ||
stage('Create Release'){ | ||
when { | ||
beforeAgent true | ||
expression { params.ACTION == "Create_Release" } | ||
} | ||
agent { | ||
docker { | ||
image "${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest" | ||
reuseNode true | ||
} | ||
} | ||
steps { | ||
dir("automation"){ | ||
sh 'gpg --batch --import $gpg_key' | ||
sh 'gpg --list-secret-keys' | ||
sh 'python3 ./make_release.py config.toml' | ||
} | ||
} | ||
} | ||
stage ('Create Release Candidate'){ | ||
when { | ||
beforeAgent true | ||
expression { params.ACTION == "Create_Release_CANDIDATE" } | ||
} | ||
agent { | ||
docker { | ||
image "${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest" | ||
reuseNode true | ||
} | ||
} | ||
steps { | ||
dir("automation"){ | ||
sh 'gpg --batch --import $gpg_key' | ||
sh 'gpg --list-secret-keys' | ||
sh 'python3 ./make_another_rc.py config.toml' | ||
} | ||
} | ||
} | ||
stage ('Close Release'){ | ||
when { | ||
beforeAgent true | ||
expression { params.ACTION == "Close_Release" } | ||
} | ||
agent { | ||
docker { | ||
image "${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest" | ||
reuseNode true | ||
} | ||
} | ||
steps { | ||
dir("automation"){ | ||
sh 'gpg --batch --import $gpg_key' | ||
sh 'gpg --list-secret-keys' | ||
sh 'python3 ./close_release.py config.toml' | ||
} | ||
} | ||
} | ||
stage ('Patch Release'){ | ||
when { | ||
beforeAgent true | ||
expression { params.ACTION == "Patch_Release" } | ||
} | ||
agent { | ||
docker { | ||
image "${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest" | ||
reuseNode true | ||
} | ||
} | ||
steps { | ||
dir("automation"){ | ||
sh 'gpg --batch --import $gpg_key' | ||
sh 'gpg --list-secret-keys' | ||
sh 'python3 ./patch_release.py config.toml' | ||
} | ||
} | ||
} | ||
} | ||
post { | ||
always { | ||
sh "docker rmi ${env.MEGA_INTERNAL_DOCKER_REGISTRY}:8443/sdk-release-management:latest" | ||
deleteDir() | ||
} | ||
} | ||
} | ||
|
||
// vim: syntax=groovy tabstop=4 shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.