|
1 | 1 | pipeline { |
2 | | - options { |
3 | | - timeout(time: 2, unit: 'HOURS') |
4 | | - buildDiscarder(logRotator(numToKeepStr:'10')) |
5 | | - disableConcurrentBuilds(abortPrevious: true) |
6 | | - } |
| 2 | + options { |
| 3 | + timeout(time: 2, unit: 'HOURS') |
| 4 | + buildDiscarder(logRotator(numToKeepStr:'10')) |
| 5 | + disableConcurrentBuilds(abortPrevious: true) |
| 6 | + } |
| 7 | + |
7 | 8 | agent { |
8 | 9 | kubernetes { |
9 | 10 | inheritFrom 'wildwebdeveloper-buildtest-pod' |
@@ -49,55 +50,152 @@ spec: |
49 | 50 | """ |
50 | 51 | } |
51 | 52 | } |
52 | | - environment { |
53 | | - NPM_CONFIG_USERCONFIG = "$WORKSPACE/.npmrc" |
54 | | - MAVEN_OPTS="-Xmx1024m" |
55 | | - GITHUB_API_CREDENTIALS_ID = 'github-bot-token' |
56 | | - } |
57 | | - stages { |
58 | | - stage('Prepare-environment') { |
59 | | - steps { |
60 | | - container('container') { |
61 | | - sh 'java -version' |
62 | | - sh 'mvn --version' |
63 | | - sh 'node --version' |
64 | | - sh 'npm --version' |
65 | | - sh 'npm config set cache="$WORKSPACE/npm-cache"' |
66 | | - } |
67 | | - } |
68 | | - } |
69 | | - stage('Build') { |
70 | | - steps { |
71 | | - container('container') { |
72 | | - withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING'), string(credentialsId: 'gpg-passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) { |
73 | | - withCredentials([string(credentialsId: "${GITHUB_API_CREDENTIALS_ID}", variable: 'GITHUB_API_TOKEN')]) { |
74 | | - wrap([$class: 'Xvnc', useXauthority: true]) { |
75 | | - sh '''mvn clean verify -B -fae -Ddownload.cache.skip=true -Dmaven.test.error.ignore=true -Dmaven.test.failure.ignore=true -Psign -Dmaven.repo.local=$WORKSPACE/.m2/repository -Dgithub.api.token="${GITHUB_API_TOKEN}" -Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" ''' |
76 | | - } |
77 | | - } |
78 | | - } |
79 | | - } |
80 | | - } |
81 | | - post { |
82 | | - always { |
83 | | - junit '*/target/surefire-reports/TEST-*.xml' |
84 | | - archiveArtifacts artifacts: 'repository/target/repository/**,*/target/work/configuration/*.log,*/target/work/data/.metadata/.log,*/target/work/data/languageServers-log/**,org.eclipse.wildwebdeveloper/target/chrome-debug-adapter/chromeDebugAdapter.zip' |
85 | | - } |
86 | | - } |
87 | | - } |
88 | | - stage('Deploy') { |
89 | | - when { |
90 | | - branch 'master' |
91 | | - } |
92 | | - steps { |
93 | | - sshagent ( ['projects-storage.eclipse.org-bot-ssh']) { |
94 | | - sh ''' |
95 | | - ssh genie.wildwebdeveloper@projects-storage.eclipse.org rm -rf /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots |
96 | | - ssh genie.wildwebdeveloper@projects-storage.eclipse.org mkdir -p /home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots |
97 | | - scp -r repository/target/repository/* genie.wildwebdeveloper@projects-storage.eclipse.org:/home/data/httpd/download.eclipse.org/wildwebdeveloper/snapshots |
98 | | - ''' |
99 | | - } |
100 | | - } |
101 | | - } |
102 | | - } |
| 53 | + |
| 54 | + environment { |
| 55 | + NPM_CONFIG_USERCONFIG = "$WORKSPACE/.npmrc" |
| 56 | + MAVEN_OPTS="-Xmx1024m" |
| 57 | + GITHUB_API_CREDENTIALS_ID = 'github-bot-token' |
| 58 | + MAIN_BRANCH = 'pr-p2.manager' |
| 59 | + GENIE = 'genie.orbit' |
| 60 | + TARGET_LOCATION = 'tools/orbit/archive/wildwebdeveloper' |
| 61 | + BUILD_TIMESTAMP = sh(returnStdout: true, script: 'date +%Y%m%d-%H%M').trim() |
| 62 | + } |
| 63 | + |
| 64 | + parameters { |
| 65 | + choice( |
| 66 | + name: 'BUILD_TYPE', |
| 67 | + choices: ['nightly', 'milestone', 'release'], |
| 68 | + description: ''' |
| 69 | + Choose the type of build. |
| 70 | + Note that a release build will not promote the build, but rather will promote the most recent milestone build. |
| 71 | + ''' |
| 72 | + ) |
| 73 | + |
| 74 | + booleanParam( |
| 75 | + name: 'PROMOTE', |
| 76 | + defaultValue: true, |
| 77 | + description: 'Whether to promote the build to the download server.' |
| 78 | + ) |
| 79 | + } |
| 80 | + |
| 81 | + stages { |
| 82 | + stage('Display Parameters') { |
| 83 | + steps { |
| 84 | + script { |
| 85 | + env.BUILD_TYPE = params.BUILD_TYPE |
| 86 | + if (env.BRANCH_NAME == env.MAIN_BRANCH) { |
| 87 | + env.WITH_CREDENTIALS = true |
| 88 | + env.MAVEN_PROFILES = "-Psign" |
| 89 | + } else { |
| 90 | + env.WITH_CREDENTIALS = false |
| 91 | + env.MAVEN_PROFILES = "" |
| 92 | + } |
| 93 | + |
| 94 | + def description = """ |
| 95 | +BRANCH_NAME=${env.BRANCH_NAME} |
| 96 | +BUILD_TIMESTAMP=${env.BUILD_TIMESTAMP} |
| 97 | +BUILD_TYPE=${env.BUILD_TYPE} |
| 98 | +MAVEN_PROFILES=${env.MAVEN_PROFILES} |
| 99 | +WITH_CREDENTIALS=${env.WITH_CREDENTIALS} |
| 100 | +""".trim() |
| 101 | + echo description |
| 102 | + currentBuild.description = description.replace("\n", "<br/>") |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + stage('Prepare-environment') { |
| 108 | + steps { |
| 109 | + container('container') { |
| 110 | + sh 'java -version' |
| 111 | + sh 'mvn --version' |
| 112 | + sh 'node --version' |
| 113 | + sh 'npm --version' |
| 114 | + sh 'npm config set cache="$WORKSPACE/npm-cache"' |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | + stage('Build') { |
| 119 | + steps { |
| 120 | + container('container') { |
| 121 | + script { |
| 122 | + if (env.WITH_CREDENTIALS == 'true') { |
| 123 | + withCredentials([file(credentialsId: 'secret-subkeys.asc', variable: 'KEYRING'), string(credentialsId: 'gpg-passphrase', variable: 'MAVEN_GPG_PASSPHRASE')]) { |
| 124 | + withCredentials([string(credentialsId: "${GITHUB_API_CREDENTIALS_ID}", variable: 'GITHUB_API_TOKEN')]) { |
| 125 | + mvn() |
| 126 | + } |
| 127 | + } |
| 128 | + stash includes: '.mvn/**,pom.xml,**/pom.xml,repository/target/repository/**,org.eclipse.wildwebdeveloper.xml/**', name: 'container-stash' |
| 129 | + } else { |
| 130 | + mvn() |
| 131 | + } |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + post { |
| 136 | + always { |
| 137 | + junit '*/target/surefire-reports/TEST-*.xml' |
| 138 | + archiveArtifacts artifacts: 'repository/target/repository/**,*/target/work/configuration/*.log,*/target/work/data/.metadata/.log,*/target/work/data/languageServers-log/**,org.eclipse.wildwebdeveloper/target/chrome-debug-adapter/chromeDebugAdapter.zip' |
| 139 | + } |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + stage('Deploy') { |
| 144 | + when { |
| 145 | + environment name: 'PROMOTE', value: 'true' |
| 146 | + } |
| 147 | + agent { |
| 148 | + label 'ubuntu-latest' |
| 149 | + } |
| 150 | + tools { |
| 151 | + maven 'apache-maven-latest' |
| 152 | + jdk 'temurin-jdk21-latest' |
| 153 | + } |
| 154 | + options { |
| 155 | + skipDefaultCheckout true |
| 156 | + } |
| 157 | + steps { |
| 158 | + unstash 'container-stash' |
| 159 | + sshagent (['projects-storage.eclipse.org-bot-ssh']) { |
| 160 | + sh 'ls -sailR' |
| 161 | + promote(); |
| 162 | + } |
| 163 | + } |
| 164 | + } |
| 165 | + } |
| 166 | +} |
| 167 | + |
| 168 | +def void mvn() { |
| 169 | + wrap([$class: 'Xvnc', useXauthority: true]) { |
| 170 | + sh ''' |
| 171 | + mvn \ |
| 172 | + clean \ |
| 173 | + verify \ |
| 174 | + -B \ |
| 175 | + -fae \ |
| 176 | + -Dgpg-keyname=C1F58CF8 \ |
| 177 | + $MAVEN_PROFILES \ |
| 178 | + -Ddownload.cache.skip=true \ |
| 179 | + -Dmaven.test.error.ignore=true \ |
| 180 | + -Dmaven.test.failure.ignore=true \ |
| 181 | + -Dmaven.repo.local=$WORKSPACE/.m2/repository \ |
| 182 | + -Dgithub.api.token="${GITHUB_API_TOKEN}" \ |
| 183 | + -Dtycho.pgp.signer.bc.secretKeys="${KEYRING}" \ |
| 184 | + ''' |
| 185 | + } |
| 186 | +} |
| 187 | + |
| 188 | +def void promote() { |
| 189 | + sh ''' |
| 190 | + mvn \ |
| 191 | + verify \ |
| 192 | + -B \ |
| 193 | + -pl :promote \ |
| 194 | + -Ppromote \ |
| 195 | + -Dbuild.type=$BUILD_TYPE \ |
| 196 | + -Dgit.commit=$GIT_COMMIT \ |
| 197 | + -Dorg.eclipse.storage.user=$GENIE \ |
| 198 | + -Dorg.eclipse.justj.p2.manager.build.url=$JOB_URL \ |
| 199 | + -Dorg.eclipse.justj.p2.manager.target=$TARGET_LOCATION \ |
| 200 | + ''' |
103 | 201 | } |
0 commit comments