Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "JakartaEE New Infra ReStaging Job"
(Created page with "Work in progress...") |
|||
Line 1: | Line 1: | ||
− | + | [[Category:Jakarta_EE]] | |
+ | This job should resolve current problem with retention period of OSSRH staging repository. It rebuilds and re-deploys artifacts from existing version tag. | ||
+ | |||
+ | == Job Configuration == | ||
+ | === Source Code Management === | ||
+ | <code>TAG</code> variable must be passed to Source Code Management section of Jenkins job configuration. | ||
+ | * Branches to build: Branch Specifier (blank for 'any'): ''tags/$TAG'' | ||
+ | |||
+ | == Job Parameters == | ||
+ | '''This project is parameterized:''' checked | ||
+ | |||
+ | {| class="wikitable" | ||
+ | !Name | ||
+ | !Type | ||
+ | !Default | ||
+ | !Description | ||
+ | |- | ||
+ | |TAG | ||
+ | |String | ||
+ | | | ||
+ | |Version tag to build. | ||
+ | |- | ||
+ | |DRY_RUN | ||
+ | |String | ||
+ | | | ||
+ | |Do not publish artifacts to OSSRH. | ||
+ | |} | ||
+ | |||
+ | == Shell Script == | ||
+ | === Job Environment === | ||
+ | Script must be executed by bash because it contains bash specific code for arrays manipulation. | ||
+ | Java SE version used to build the project depends on each project so it must be set properly. | ||
+ | <pre> | ||
+ | #!/bin/bash -ex | ||
+ | |||
+ | TOOLS_PREFIX='/opt/tools' | ||
+ | JAVA_PREFIX="${TOOLS_PREFIX}/java/openjdk" | ||
+ | MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest" | ||
+ | JAVA_HOME="${JAVA_PREFIX}/jdk-11/latest" | ||
+ | PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
+ | |||
+ | # Maven plugins | ||
+ | HELP_PLUGIN='org.apache.maven.plugins:maven-help-plugin:3.1.0' | ||
+ | </pre> | ||
+ | |||
+ | === Job Parameters Processing === | ||
+ | Value of <code>TAG</code> must be set and must be non empty. Build must fail if those conditions are not met. | ||
+ | Project and parent version numbers are retrieved from Maven POM. | ||
+ | Maven target to be executed depends on <code>DRY_RUN</code> value. Artifacts deployment must be suppressed when <code>DRY_RUN</code> is set to <code>true</code>. | ||
+ | <pre> | ||
+ | # Tag value is mandatory, fail the build if missing. | ||
+ | if [ -z "${TAG}" ]; then | ||
+ | echo '-[ Missing required release tag! ]----------------------------------------------' | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | # Compute release version | ||
+ | RELEASE_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+$'` | ||
+ | # Compute parent version | ||
+ | PARENT_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.parent.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+$'` | ||
+ | |||
+ | echo "Release tag: ${TAG}" | ||
+ | echo "Release version: ${RELEASE_VERSION}" | ||
+ | echo "Parent version: ${PARENT_VERSION}" | ||
+ | |||
+ | # Execute install target only on dry run. | ||
+ | if [ ${DRY_RUN} = 'true' ]; then | ||
+ | echo '-[ Dry run turned on ]----------------------------------------------------------' | ||
+ | MVN_DEPLOY_ARGS='install' | ||
+ | else | ||
+ | MVN_DEPLOY_ARGS='deploy' | ||
+ | fi | ||
+ | </pre> |
Revision as of 08:23, 20 December 2018
This job should resolve current problem with retention period of OSSRH staging repository. It rebuilds and re-deploys artifacts from existing version tag.
Contents
Job Configuration
Source Code Management
TAG
variable must be passed to Source Code Management section of Jenkins job configuration.
- Branches to build: Branch Specifier (blank for 'any'): tags/$TAG
Job Parameters
This project is parameterized: checked
Name | Type | Default | Description |
---|---|---|---|
TAG | String | Version tag to build. | |
DRY_RUN | String | Do not publish artifacts to OSSRH. |
Shell Script
Job Environment
Script must be executed by bash because it contains bash specific code for arrays manipulation. Java SE version used to build the project depends on each project so it must be set properly.
#!/bin/bash -ex TOOLS_PREFIX='/opt/tools' JAVA_PREFIX="${TOOLS_PREFIX}/java/openjdk" MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest" JAVA_HOME="${JAVA_PREFIX}/jdk-11/latest" PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Maven plugins HELP_PLUGIN='org.apache.maven.plugins:maven-help-plugin:3.1.0'
Job Parameters Processing
Value of TAG
must be set and must be non empty. Build must fail if those conditions are not met.
Project and parent version numbers are retrieved from Maven POM.
Maven target to be executed depends on DRY_RUN
value. Artifacts deployment must be suppressed when DRY_RUN
is set to true
.
# Tag value is mandatory, fail the build if missing. if [ -z "${TAG}" ]; then echo '-[ Missing required release tag! ]----------------------------------------------' exit 1 fi # Compute release version RELEASE_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+$'` # Compute parent version PARENT_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.parent.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+$'` echo "Release tag: ${TAG}" echo "Release version: ${RELEASE_VERSION}" echo "Parent version: ${PARENT_VERSION}" # Execute install target only on dry run. if [ ${DRY_RUN} = 'true' ]; then echo '-[ Dry run turned on ]----------------------------------------------------------' MVN_DEPLOY_ARGS='install' else MVN_DEPLOY_ARGS='deploy' fi