This repository was archived by the owner on Aug 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile-release-config
44 lines (41 loc) · 2.18 KB
/
Jenkinsfile-release-config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// This Jenkinsfile is used by Jenkins to run the ConfirmReleaseConfigs step, now a part of Reactome's release.
// This is the first step of release now. It is an attempt to ensure that all configurations for release have been set, and that they match.
pipeline{
agent any
stages{
// This takes user inputs in to confirm that the configuration file and environmental variables used be Jenkins have been updated for this release.
// After the user inputs, it executes a bash script that checks the values to confirm that they all match.
stage('Confirm configurations'){
steps{
// This asks for confirmation the configuration file has been updated for this release.
// This is a locally-scoped secret file accessed at Jenkins -> Releases -> ## (release number) -> Credentials -> Config
script{
def userInput = input(
id: 'userInput', message: "Has the Config file credentials been updated for this release?",
parameters: [
[$class: 'TextParameterDefinition', defaultValue: '', name: 'response']
])
if (!userInput.toLowerCase().startsWith("y")){
error("Please update the config file for this release and upload it in Jenkins as a secret file credential. Please have the credential scoped to this folder.")
}
}
dir('scripts'){
script{
// This asks for the release number. Afterwards this input, along with the config file and environmental variables for
// release and previous release numbers are checked in a bash file to confirm they all match.
def userReleaseNumber = input(
id: 'userInput', message: "Enter release version number.",
parameters: [
[$class: 'TextParameterDefinition', defaultValue: '', name: 'response']
])
def currentRelease = (pwd() =~ /Releases\/(\d+)\//)[0][1];
def previousRelease = (pwd() =~ /Releases\/(\d+)\//)[0][1].toInteger() - 1;
withCredentials([file(credentialsId: 'Config', variable: 'ConfigFile')]){
sh "bash confirmJenkinsConfigurations.sh --config $ConfigFile --env-release-current ${currentRelease} --env-release-previous ${previousRelease} --user-release $userReleaseNumber"
}
}
}
}
}
}
}