Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .jenkins/scripts/docker_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,23 @@ set -xe
# $1: docker tag version
# $2: should tag as latest (true/false) default is false
# $3: requested image, if not given, all will be pushed
#
# Environment:
# DRY_RUN: when "true", images are built to a local tar file ("jib:buildTar") instead of being built
# and pushed to the registry ("jib:build"). This lets the whole stage be exercised (including
# the Maven/Jib configuration) without needing registry credentials or a daemon, and without
# publishing anything. Defaults to false.

_TAG="${1?Missing tag}"
_IS_LATEST="${2-false}"
_ONLY_ONE_IMAGE="${3}"

_JIB_GOAL="jib:build@build"
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: images will be built to a local tar file instead of being pushed\n"
_JIB_GOAL="jib:buildTar@build"
fi

dockerBuild() {
_IMAGE="${1}"
printf ">> Building and push %s:%s\n" "{$_IMAGE}" "${_TAG}"
Expand All @@ -35,13 +47,13 @@ dockerBuild() {

local skip_for_docker_build="-DskipTests -DskipITs -Dcheckstyle.skip -Denforcer.skip=true -Drat.skip -Dspotless.skip=true"

mvn package jib:build@build \
mvn package "${_JIB_GOAL}" \
--file "images/${_IMAGE}-image/pom.xml" \
--define docker.talend.image.tag="${_TAG}" \
$skip_for_docker_build

if [[ ${_IS_LATEST} == 'true' ]]; then
mvn package jib:build@build \
mvn package "${_JIB_GOAL}" \
--file "images/${_IMAGE}-image/pom.xml" \
--define docker.talend.image.tag=latest \
$skip_for_docker_build
Expand Down
11 changes: 11 additions & 0 deletions .jenkins/scripts/release/release-2-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,22 @@ set -xe
# $2: next version
# $3: tag name
# $4: extra build args for all mvn cmd
#
# Environment:
# DRY_RUN: when "true", release:prepare runs with -DdryRun=true. Poms are rewritten and validated
# locally, but nothing is committed, tagged or pushed. Defaults to false.
main() {
local releaseVersion="${1?Missing release version}"; shift
local nextVersion="${1?Missing actual project version}"; shift
local tagName="${1?Missing actual project version}"; shift
local extraBuildParams=("$@")

local dryRunParams=()
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: release:prepare will not commit, tag nor push\n"
dryRunParams=(--define dryRun=true)
fi

printf ">> Maven prepare release %s (next-dev: %s; tag: %s)\n" "${releaseVersion}" "${nextVersion}" "${tagName}"

local release_profiles="release,ossrh,gpg2"
Expand All @@ -41,6 +51,7 @@ main() {
--define arguments="-DskipTests -DskipITs -Dcheckstyle.skip -Denforcer.skip=true -Drat.skip" \
--settings .jenkins/settings.xml \
--activate-profiles "$release_profiles" \
"${dryRunParams[@]}" \
"${extraBuildParams[@]}"
}

Expand Down
29 changes: 26 additions & 3 deletions .jenkins/scripts/release/release-4-docker-image-creation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,41 @@ set -xe
# $1: release version
# $2: tag name
# $3: branch name
#
# Environment:
# DRY_RUN: when "true":
# - the branch push is simulated with "git push --dry-run" (no ref is actually updated).
# Note: this only catches repository-level access issues; it does NOT reliably reproduce
# a server-side rejection of a specific ref (e.g. branch protection), since that only
# happens during the real object transfer, which --dry-run skips.
# - the release tag checkout is skipped, since under DRY_RUN no tag was actually created by
# release:prepare (it also runs with -DdryRun=true): the docker image is instead built from
# the current workspace state (still on $branchName, poms still at the SNAPSHOT version).
# - the docker image is built to a local tar file instead of being pushed to the registry
# (see docker_build.sh).
# Defaults to false.
main() {
local releaseVersion="${1?Missing release version}"
local tagName="${2?Missing actual project version}"
local branchName="${3?Missing actual project version}"

local pushDryRunParams=()
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: push to github will be simulated with --dry-run\n"
pushDryRunParams=(--dry-run)
fi

printf ">> Docker image creation from branch %s with tag: %s on version %s\n" "$releaseVersion" "$tagName" "$branchName"
printf "Reset repo\n"
git reset --hard
git push -u origin "${branchName}" --follow-tags
git push "${pushDryRunParams[@]}" -u origin "${branchName}" --follow-tags

printf "Checkout the release tag as a branch\n"
git checkout -b "${tagName}" "${tagName}"
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: skipping checkout of tag %s (nothing was tagged under DRY_RUN)\n" "${tagName}"
else
printf "Checkout the release tag as a branch\n"
git checkout -b "${tagName}" "${tagName}"
fi

printf "Activate lastest tagging for master branch\n"
local tag_latest=""
Expand Down
17 changes: 16 additions & 1 deletion .jenkins/scripts/release/release-5-prepare-next-iteration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,23 @@ set -xe
# Parameters:
# $1: branch name
# $2: extra build args for all mvn cmd
#
# Environment:
# DRY_RUN: when "true", the final push is simulated with "git push --dry-run" without actually
# updating the remote. Note: this only catches repository-level access issues (e.g. no
# access at all to the repo); it does NOT reliably reproduce a server-side rejection of a
# specific ref (e.g. branch protection, restricted credentials) since that only happens
# during the real object transfer, which --dry-run skips. Defaults to false.
main() {
local branchName="${1?Missing actual project version}"; shift
local extraBuildParams=("$@")

local pushDryRunParams=()
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: push to github will be simulated with --dry-run\n"
pushDryRunParams=(--dry-run)
fi

printf ">> Rebuilding %s and updating it (doc) for next iteration\n" "${branchName}"
git reset --hard
git checkout "${branchName}"
Expand All @@ -37,8 +50,10 @@ main() {
"${extraBuildParams[@]}" || true

printf "Push to github\n"
# "|| true" is here to avoid blocking the jenkins pipeline when there is nothing to commit
git commit -a -m "Updating doc for next iteration" || true
git push -u origin "${branchName}" || true
# NOT swallowing failures here: a rejected push (e.g. permission denied) must fail the stage
git push "${pushDryRunParams[@]}" -u origin "${branchName}"

}

Expand Down
15 changes: 14 additions & 1 deletion .jenkins/scripts/release/release-6-create-maintenance-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,23 @@ set -xe
# Parameters:
# $1: maintenance branch name
# $2: maintenance version
#
# Environment:
# DRY_RUN: when "true", the final push is simulated with "git push --dry-run" without actually
# updating the remote. Note: this only catches repository-level access issues (e.g. no
# access at all to the repo); it does NOT reliably reproduce a server-side rejection of a
# specific ref (e.g. branch protection, restricted credentials) since that only happens
# during the real object transfer, which --dry-run skips. Defaults to false.
main() {
local maintenanceBranch="${1?Missing maintenance branch name}"
local maintenanceVersion="${2?Missing maintenance version}"

local pushDryRunParams=()
if [[ "${DRY_RUN:-false}" == "true" ]]; then
printf ">> DRY RUN: push maintenance branch will be simulated with --dry-run\n"
pushDryRunParams=(--dry-run)
fi

printf ">> Creating %s with %s\n" "${maintenanceBranch}" "${maintenanceVersion}"

git checkout -b "${maintenanceBranch}"
Expand All @@ -37,7 +50,7 @@ main() {

printf "Push maintenance branch\n"
git commit -a -m "[jenkins-release] prepare for next development iteration ${maintenanceBranch}"
git push -u origin "${maintenanceBranch}"
git push "${pushDryRunParams[@]}" -u origin "${maintenanceBranch}"

}

Expand Down
12 changes: 11 additions & 1 deletion .jenkins/scripts/release_legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ set -xe
# $1: Branch
# $2: current version
# $3: extra build args for all mvn cmd
#
# NOTE: VersionController.getSnapshotVersion (tqa-e2e-tests-tool shared library), used by
# ci/Jenkinsfile-release, is the source of truth for the release version scheme.
# The bump below is kept in sync with it: on the calendar scheme 1.<YYMM>.<patch>,
# December rolls over to January of the next year (1.2612.0 -> 1.2701.0).
main() {
local branch="${1?Missing branch}"
local currentVersion="${2?Missing project version}"
Expand All @@ -39,7 +44,12 @@ main() {
if [[ ${branch} == 'master' ]]; then
maintenance_branch="maintenance/${maj}.${min}"
maintenance_version="${maj}.${min}.$((rev + 1))-SNAPSHOT"
min=$((min + 1))
if [[ ${#min} -eq 4 && ${min} == *12 ]]; then
# Calendar scheme 1.<YYMM>.<patch>: December rolls over to January of the next year
min=$((min + 89))
else
min=$((min + 1))
fi
rev="0"
else
rev=$((rev + 1))
Expand Down
14 changes: 8 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ pipeline {
defaultValue: false,
description: '''
Force MAVEN deploy stage for development branches. No effect on master and maintenance.
INFO: master/maintenance branch are deploying on <oss.sonatype.org>
dev branches are deploying on <artifacts-zl.talend.com>''')
INFO: master/maintenance branch deploys artefacts on <oss.sonatype.org>
dev branches deploy artefacts on <artifacts-zl.talend.com>''')
booleanParam(
name: 'DOCKER_PUSH',
defaultValue: false,
Expand All @@ -166,7 +166,7 @@ pipeline {
'component-starter-server',
'remote-engine-customizer',
'All'],
description: 'Choose which docker image you want to build and push. Only available if DOCKER_PUSH == True.')
description: 'Choose which Docker image you want to build and push. Only available if DOCKER_PUSH == True.')

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "QUALIFIER_CONFIG",
Expand All @@ -181,7 +181,9 @@ pipeline {
description: '''
Deploy jars with the given version qualifier. No effect on master and maintenance.
- DEFAULT means the qualifier will be the Jira id extracted from the branch name.
From "user/JIRA-12345_some_information" the qualifier will be JIRA-12345.''')
From "user/JIRA-12345_some_information" the qualifier will be JIRA-12345.
If you want to deploy a snapshot version without qualifier, use the NO_QUALIFIER parameter below
''')

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
separator(name: "ADVANCED_CONFIG",
Expand All @@ -193,7 +195,7 @@ pipeline {
string(
name: 'EXTRA_BUILD_PARAMS',
defaultValue: '',
description: 'Add some extra parameters to maven commands. Applies to all maven calls.')
description: 'Add some extra parameters to all maven commands.')
booleanParam(
name: 'DISABLE_SONAR',
defaultValue: false,
Expand Down Expand Up @@ -239,7 +241,7 @@ pipeline {
booleanParam(
name: 'JENKINS_DEBUG',
defaultValue: false,
description: 'Add an extra step to the pipeline allowing to keep the pod alive for debug purposes.')
description: 'Add an extra step to the pipeline to keep the pod alive for debug purposes.')
booleanParam(
name: 'NO_QUALIFIER',
defaultValue: false,
Expand Down
Loading
Loading