forked from apache/incubator-kie-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kie-issues#2693: [SonataFlow] SonataFlow Management Console on KIE To…
…ols release job (apache#2694)
- Loading branch information
1 parent
e9e0ac0
commit 70dd585
Showing
1 changed file
with
209 additions
and
0 deletions.
There are no files selected for viewing
209 changes: 209 additions & 0 deletions
209
.ci/jenkins/release-jobs/Jenkinsfile.sonataflow-management-console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
pipeline { | ||
agent { | ||
docker { | ||
image 'docker.io/apache/incubator-kie-tools-ci-build:main' | ||
args '--shm-size=2g --privileged --group-add docker' | ||
} | ||
} | ||
|
||
options { | ||
timeout(time: 60, unit: 'MINUTES') | ||
} | ||
|
||
parameters { | ||
booleanParam(description: 'Dry run', name: 'DRY_RUN', defaultValue: true) | ||
string(description: 'Release Version', name: 'RELEASE_VERSION', defaultValue: '0.0.0') | ||
string(description: 'Base Ref', name: 'BASE_REF') | ||
string(description: 'Release Candidate Version', name: 'RELEASE_CANDIDATE_VERSION', defaultValue: '') | ||
} | ||
|
||
environment { | ||
KIE_TOOLS_BUILD__runLinters = 'false' | ||
KIE_TOOLS_BUILD__runTests = 'false' | ||
KIE_TOOLS_BUILD__runEndToEndTests = 'false' | ||
KIE_TOOLS_BUILD__buildContainerImages = 'true' | ||
|
||
SONATAFLOW_MANAGEMENT_CONSOLE__registry = 'docker.io' | ||
SONATAFLOW_MANAGEMENT_CONSOLE__account = 'apache' | ||
SONATAFLOW_MANAGEMENT_CONSOLE__name = 'incubator-kie-sonataflow-management-console' | ||
SONATAFLOW_MANAGEMENT_CONSOLE__buildTag = "latest ${params.RELEASE_VERSION}" | ||
|
||
RELEASE_ARTIFACTS_DIR = "${WORKSPACE}/release-artifacts" | ||
|
||
DOCKER_CONFIG = "${WORKSPACE}/.docker" | ||
|
||
PNPM_FILTER_STRING = '-F @kie-tools/sonataflow-management-console-image...' | ||
} | ||
|
||
stages { | ||
stage('Load local shared scripts') { | ||
steps { | ||
script { | ||
pipelineVars = load '.ci/jenkins/shared-scripts/pipelineVars.groovy' | ||
buildUtils = load '.ci/jenkins/shared-scripts/buildUtils.groovy' | ||
githubUtils = load '.ci/jenkins/shared-scripts/githubUtils.groovy' | ||
dockerUtils = load '.ci/jenkins/shared-scripts/dockerUtils.groovy' | ||
releaseUtils = load '.ci/jenkins/shared-scripts/releaseUtils.groovy' | ||
} | ||
} | ||
} | ||
|
||
stage('Start required services for build and tests (DinD, Xvfb, Fluxbox)') { | ||
steps { | ||
script { | ||
buildUtils.startRequiredServices() | ||
} | ||
} | ||
} | ||
|
||
stage('Clean workspace before build') { | ||
steps { | ||
cleanWs(deleteDirs: true, disableDeferredWipeout: true) | ||
} | ||
} | ||
|
||
stage('Load upstream images') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
upstreamReleaseArtifactsDir = "${WORKSPACE}/upstream-release-artifacts" | ||
releaseUtils.downloadReleaseArtifacts("${pipelineVars.asfReleaseStagingRepository}", "${upstreamReleaseArtifactsDir}", "${params.RELEASE_CANDIDATE_VERSION}") | ||
upstreamImagesArtifacts = releaseUtils.getUpstreamImagesArtifactsList("${upstreamReleaseArtifactsDir}", "${params.RELEASE_CANDIDATE_VERSION}") | ||
dockerUtils.loadImages(upstreamImagesArtifacts as String[]) | ||
} | ||
} | ||
} | ||
|
||
stage('Checkout kie-tools') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
githubUtils.checkoutRepo( | ||
"http://github.com/${pipelineVars.githubRepositorySlug}.git", | ||
"${params.BASE_REF}", | ||
"${pipelineVars.kieToolsBotGithubCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Setup PNPM') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.setupPnpm("${pipelineVars.mavenSettingsReleaseConfigFileId}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('PNPM Bootstrap') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.pnpmBootstrap("${env.PNPM_FILTER_STRING}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.pnpmBuild("${env.PNPM_FILTER_STRING}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Push sonataflow-management-console to Docker Hub') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION == '' } | ||
} | ||
steps { | ||
script { | ||
dockerUtils.pushImageToRegistry( | ||
"${env.SONATAFLOW_MANAGEMENT_CONSOLE__registry}", | ||
"${env.SONATAFLOW_MANAGEMENT_CONSOLE__account}", | ||
"${env.SONATAFLOW_MANAGEMENT_CONSOLE__name}", | ||
"${env.SONATAFLOW_MANAGEMENT_CONSOLE__buildTag}", | ||
"${pipelineVars.dockerHubUserCredentialsId}", | ||
"${pipelineVars.dockerHubTokenCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
|
||
stage('Setup release candidate artifacts') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
env.RELEASE_IMAGE_TAR_FILE = "incubator-kie-${params.RELEASE_CANDIDATE_VERSION}-sonataflow-management-console-image.tar.gz" | ||
|
||
sh """#!/bin/bash -el | ||
mkdir ${env.RELEASE_ARTIFACTS_DIR} | ||
docker save "${env.SONATAFLOW_MANAGEMENT_CONSOLE__registry}/${env.SONATAFLOW_MANAGEMENT_CONSOLE__account}/${env.SONATAFLOW_MANAGEMENT_CONSOLE__name}:${params.RELEASE_VERSION}" | gzip > "${env.RELEASE_ARTIFACTS_DIR}/${env.RELEASE_IMAGE_TAR_FILE}" | ||
""".trim() | ||
} | ||
} | ||
} | ||
|
||
stage('Sign artifact for Apache release') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
dir("${env.RELEASE_ARTIFACTS_DIR}") { | ||
script { | ||
releaseUtils.setupSigningKey("${pipelineVars.asfReleaseGPGKeyCredentialsId}") | ||
releaseUtils.signArtifact("${env.RELEASE_IMAGE_TAR_FILE}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Publish Release Candidate artifacts') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
releaseUtils.publishArtifacts( | ||
"${env.RELEASE_ARTIFACTS_DIR}", | ||
"${pipelineVars.asfReleaseStagingRepository}", | ||
"${params.RELEASE_CANDIDATE_VERSION}", | ||
"${pipelineVars.asfReleaseSVNStagingCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
cleanWs(deleteDirs: true) | ||
} | ||
} | ||
} |