diff --git a/Jenkinsfile.deploy b/Jenkinsfile.deploy index 2116151..aece0d6 100644 --- a/Jenkinsfile.deploy +++ b/Jenkinsfile.deploy @@ -1,10 +1,6 @@ pipeline { agent { label 'djb-vm' } - triggers { - cron('H/10 * * * *') - } - options { timestamps() disableConcurrentBuilds() @@ -23,8 +19,6 @@ pipeline { CATALINA_HOME = '/prod/eapim/apache-tomcat-9.0.116' CATALINA_PID = '/prod/eapim/devportal/temp/catalina.pid' DEPLOY_HTTP_PORT = '39130' - REVISION_STATE_FILE = '.jenkins-last-deploy-revisions' - SHOULD_DEPLOY = 'true' } stages { @@ -66,52 +60,7 @@ pipeline { } } - stage('Detect changes') { - steps { - script { - int status = sh( - returnStatus: true, - script: ''' - set -eu - current_file="$(mktemp)" - { - printf 'eapim-portal %s\\n' "$(git rev-parse HEAD)" - printf 'elink-portal-common %s\\n' "$(git -C "$WORKSPACE/../elink-portal-common" rev-parse HEAD)" - printf 'eapim-online/elink-online-core-jpa %s\\n' "$(git -C "$WORKSPACE/../eapim-online/elink-online-core-jpa" rev-parse HEAD)" - } | sort > "$current_file" - - if [ -f "$REVISION_STATE_FILE" ] && cmp -s "$current_file" "$REVISION_STATE_FILE"; then - echo "No repository changes detected. Skipping test, build and deploy." - echo "--- current revisions ---" - cat "$current_file" - rm -f "$current_file" - exit 10 - fi - - echo "Repository changes detected. Test, build and deploy will run." - echo "--- previous revisions ---" - [ -f "$REVISION_STATE_FILE" ] && cat "$REVISION_STATE_FILE" || echo "(none)" - echo "--- current revisions ---" - cat "$current_file" - mv "$current_file" .jenkins-current-deploy-revisions - ''' - ) - if (status == 10) { - env.SHOULD_DEPLOY = 'false' - currentBuild.description = 'No repo changes' - } else if (status != 0) { - error "Revision change detection failed with status ${status}" - } else { - env.SHOULD_DEPLOY = 'true' - } - } - } - } - stage('Verify toolchain') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh ''' set -eu @@ -122,9 +71,6 @@ pipeline { } stage('Test') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh 'gradle clean test --no-daemon' } @@ -137,9 +83,6 @@ pipeline { } stage('Build WAR') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh 'gradle build -x test --no-daemon' } @@ -157,9 +100,6 @@ pipeline { } stage('Stop Tomcat') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh ''' set +e @@ -178,9 +118,6 @@ pipeline { } stage('Deploy ROOT.war') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh ''' set -eu @@ -193,9 +130,6 @@ pipeline { } stage('Start Tomcat and readiness') { - when { - expression { env.SHOULD_DEPLOY == 'true' } - } steps { sh ''' set -eu @@ -252,18 +186,4 @@ pipeline { } } - post { - success { - script { - if (env.SHOULD_DEPLOY == 'true') { - sh ''' - set -eu - if [ -f .jenkins-current-deploy-revisions ]; then - mv .jenkins-current-deploy-revisions "$REVISION_STATE_FILE" - fi - ''' - } - } - } - } }