Skip to content

Commit

Permalink
Test stash/unstash actions in jenkins pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonjacob committed Jan 10, 2023
1 parent 7ba85ed commit ef83ec2
Showing 1 changed file with 44 additions and 9 deletions.
53 changes: 44 additions & 9 deletions Jenkinsfile-release
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,57 @@ pipeline {
jdk 'openjdk-jdk17-latest'
}
stages {
stage('Tag Release') {
stage('Initialize PGP') {
steps {
withCredentials([usernamePassword(credentialsId: 'github-bot-brandon', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING')]) {
sh '''
git config --global user.email docs-bot@eclipse.org
mvn -B -V -e -Ptag-release -DpushChanges="${PERFORM_RELEASE}" -Dtycho.mode=maven -Dusername="${USERNAME}" -Dpassword="${PASSWORD}" build-helper:parse-version scm:tag -pl .
gpg --batch --import "${KEYRING}"
for fpr in $(gpg --list-keys --with-colons | awk -F: \'/fpr:/ {print $10}\' | sort -u);
do
echo -e "5\ny\n" | gpg --batch --command-fd 0 --expert --edit-key ${fpr} trust;
done
'''
}
}
}
stage('Bump Development Version') {
stage('Build and Deploy Maven Artifacts') {
steps {
withCredentials([usernamePassword(credentialsId: 'github-bot-brandon', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
sh '''
git config --global user.email docs-bot@eclipse.org
mvn -B -V -e -Pcommit-version-update -DpushChanges="${PERFORM_RELEASE}" -Dtycho.mode=maven -Dusername="${USERNAME}" -Dpassword="${PASSWORD}" build-helper:parse-version versions:set-property antrun:run scm:checkin -pl .
withCredentials([string(credentialsId: 'gpg-passphrase', variable: 'KEYRING_PASSPHRASE')]) {
wrap([$class: 'Xvnc', useXauthority: true]) {
sh 'mvn clean install -U -B -V -e -s /home/jenkins/.m2/settings-deploy-ossrh-docs.xml -Psign -Possrh -Dmaven.repo.local=$WORKSPACE/.m2/repository -Dtycho.buildqualifier.format=yyyyMMddHHmm -Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true -DskipTests=true -Ddash.fail=false -Dgpg.passphrase="${KEYRING_PASSPHRASE}"'
}
}
dir("docs/org.eclipse.mylyn.docs-site/target/repository") {
stash includes: '**', name: 'docsSite'

sh '''#!/bin/bash
ls -laR
'''
}
}
}
stage('Deploy Update Site') {
steps {
dir("docs/org.eclipse.mylyn.docs-site/target/repository") {
deleteDir()
unstash 'docsSite'

sh '''#!/bin/bash
'''
}
sshagent (['projects-storage.eclipse.org-bot-ssh']) {
sh '''#!/bin/bash

RELEASE_VERSION="$(grep '\\s*<releaseVersion>.*</releaseVersion>' pom.xml | sed -e 's|\\s*<releaseVersion>\\([0-9]\\+\\.[0-9]\\+\\).*</releaseVersion>.*|\\1|')"
RELEASE_VERSION_FULL="$(grep '\\s*<releaseVersion>.*</releaseVersion>' pom.xml | sed -e 's|\\s*<releaseVersion>\\(.*\\)</releaseVersion>.*|\\1|')"

DOWNLOAD_AREA=/home/data/httpd/download.eclipse.org/mylyn/docs/releases/$RELEASE_VERSION
echo "DOWNLOAD_AREA=$DOWNLOAD_AREA"

DOWNLOAD_AREA_FULL=/home/data/httpd/download.eclipse.org/mylyn/docs/releases/$RELEASE_VERSION_FULL
echo "DOWNLOAD_AREA_FULL=$DOWNLOAD_AREA_FULL"

ls -laR docs/org.eclipse.mylyn.docs-site/target/repository
'''
}
}
Expand Down

0 comments on commit ef83ec2

Please sign in to comment.