This is an automated email from the ASF dual-hosted git repository. rantunes pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools-temporary-rnd-do-not-use.git
commit e412c72b9ef7a79325ef8d483df9433e228c5bc1 Author: Rodrigo Antunes <[email protected]> AuthorDate: Wed Nov 29 12:58:03 2023 -0300 CI - Staging build and publish Jenkins jobs (#13) * CI - Staging build and publish Jenkins jobs * CI - Add squashed merge * Fix upload asset url * Add missing asset upload * Add missing asset upload * Reflect library changes * Update staging publish job to use lib utilities * Fix base ref for dry run job * Use shared scripts * Use shared scripts * Rename Jenkins job files * Fix jobs names * Fix job name --- .ci/jenkins/Jenkinsfile.staging-build | 886 ++++++++++++++++++++++++++++++++ .ci/jenkins/Jenkinsfile.staging-dry-run | 44 ++ .ci/jenkins/Jenkinsfile.staging-publish | 123 +++++ 3 files changed, 1053 insertions(+) diff --git a/.ci/jenkins/Jenkinsfile.staging-build b/.ci/jenkins/Jenkinsfile.staging-build new file mode 100644 index 0000000000..1f9be8cb41 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.staging-build @@ -0,0 +1,886 @@ +/* + * 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 'quay.io/kie-tools/kie-tools-ci-build:latest' + args '--shm-size=2g --privileged --group-add docker' + } + } + + options { + timeout(time: 240, unit: 'MINUTES') + } + + parameters { + booleanParam(description: 'Dry run', name: 'DRY_RUN', defaultValue: true) + string(description: 'Base Ref', name: 'BASE_REF') + string(description: 'Tag', name: 'TAG', defaultValue: '0.0.0') + string(description: 'Commit SHA', name: 'COMMIT_SHA', defaultValue: 'main') + string(description: 'Download asset url', name: 'DOWNLOAD_ASSET_URL', defaultValue: '') + string(description: 'Upload asset url', name: 'UPLOAD_ASSET_URL', defaultValue: '') + } + + environment { + OPENSHIFT_NAMESPACE = 'kie-sandbox' + OPENSHIFT_PART_OF = 'staging-kie-sandbox-app' + + DMN_DEV_DEPLOYMENT_BASE_IMAGE__registry = 'quay.io' + DMN_DEV_DEPLOYMENT_BASE_IMAGE__account = 'kie-tools' + DMN_DEV_DEPLOYMENT_BASE_IMAGE__name = 'dmn-dev-deployment-base-image' + DMN_DEV_DEPLOYMENT_BASE_IMAGE__buildTags = "${params.TAG}-prerelease" + ONLINE_EDITOR__dmnDevDeploymentBaseImageRegistry = 'quay.io' + ONLINE_EDITOR__dmnDevDeploymentBaseImageAccount = 'kie-tools' + ONLINE_EDITOR__dmnDevDeploymentBaseImageName = 'dmn-dev-deployment-base-image' + ONLINE_EDITOR__dmnDevDeploymentBaseImageTag = "${params.TAG}-prerelease" + + KIE_SANDBOX__imageRegistry = 'quay.io' + KIE_SANDBOX__imageAccount = 'kie-tools' + KIE_SANDBOX__imageName = 'kie-sandbox-image' + KIE_SANDBOX__imageBuildTags = "${params.TAG}-prerelease" + + KIE_SANDBOX_EXTENDED_SERVICES__imageRegistry = 'quay.io' + KIE_SANDBOX_EXTENDED_SERVICES__imageAccount = 'kie-tools' + KIE_SANDBOX_EXTENDED_SERVICES__imageName = 'kie-sandbox-extended-services-image' + KIE_SANDBOX_EXTENDED_SERVICES__imageBuildTags = "${params.TAG}-prerelease" + + CORS_PROXY_IMAGE__imageRegistry = 'quay.io' + CORS_PROXY_IMAGE__imageAccount = 'kie-tools' + CORS_PROXY_IMAGE__imageName = 'cors-proxy-image' + CORS_PROXY_IMAGE__imageBuildTags = "${params.TAG}-prerelease" + + DEPLOY_TAG = "${params.TAG}-prerelease" + + DASHBUILDER__viewerImageRegistry = 'quay.io' + DASHBUILDER__viewerImageAccount = 'kie-tools' + DASHBUILDER__viewerImageName = 'dashbuilder-viewer-image' + DASHBUILDER__viewerImageBuildTags = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__dashbuilderViewerImageTag = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageRegistry = 'quay.io' + SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageAccount = 'kie-tools' + SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageName = 'serverless-logic-web-tools-swf-builder-image' + SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageTag = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageBuildTags = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageRegistry = 'quay.io' + SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageAccount = 'kie-tools' + SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageName = 'serverless-logic-web-tools-base-builder-image' + SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageTag = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageBuildTags = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageRegistry = 'quay.io' + SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageAccount = 'kie-tools' + SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageName = 'serverless-logic-web-tools-swf-dev-mode-image' + SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageTag = "${params.TAG}-prerelease" + SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageBuildTags = "${params.TAG}-prerelease" + + DOCKER_CONFIG = "${WORKSPACE}/.docker" + } + + 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' + openShiftUtils = load '.ci/jenkins/shared-scripts/openShiftUtils.groovy' + dockerUtils = load '.ci/jenkins/shared-scripts/dockerUtils.groovy' + zipUtils = load '.ci/jenkins/shared-scripts/zipUtils.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('Checkout kie-tools') { + steps { + dir('kie-tools') { + script { + githubUtils.checkoutRepo( + "http://github.com/${pipelineVars.githubRepositorySlug}.git", + "${params.BASE_REF}", + "${pipelineVars.kieToolsBotGithubCredentialsId}" + ) + } + } + } + } + + stage('Checkout kogito-online-staging') { + when { + expression { !params.DRY_RUN } + } + steps { + dir('kogito-online-staging') { + script { + githubUtils.checkoutRepo( + 'https://github.com/kiegroup/kogito-online-staging.git', + 'main', + "${pipelineVars.kieToolsBotGithubCredentialsId}" + ) + } + } + } + } + + stage('Checkout serverless-logic-sandbox-deployment') { + when { + expression { !params.DRY_RUN } + } + steps { + dir('serverless-logic-sandbox-deployment') { + script { + githubUtils.checkoutRepo( + 'https://github.com/kiegroup/serverless-logic-sandbox-deployment.git', + 'gh-pages', + "${pipelineVars.kieToolsBotGithubCredentialsId}" + ) + } + } + } + } + + stage('Setup PNPM') { + steps { + dir('kie-tools') { + script { + buildUtils.setupPnpm() + } + } + } + } + + stage('PNPM Bootstrap') { + steps { + dir('kie-tools') { + script { + buildUtils.pnpmBootstrap() + } + } + } + } + + stage('Build (without some images)') { + steps { + dir('kie-tools') { + sh """#!/bin/bash -el + export KIE_TOOLS_BUILD__runEndToEndTests=false + export KIE_TOOLS_BUILD__runTests=false + export KIE_TOOLS_BUILD__runLinters=false + export KIE_TOOLS_BUILD__buildContainerImages=true + export WEBPACK__minimize=true + export WEBPACK__tsLoaderTranspileOnly=false + export CHROME_EXTENSION__routerTargetOrigin=https://kiegroup.github.io + export CHROME_EXTENSION__routerRelativePath=kogito-online-staging/${params.TAG}-prerelease/chrome-extension + export CHROME_EXTENSION__onlineEditorUrl=https://kiegroup.github.io/kogito-online-staging/${params.TAG}-prerelease + export CHROME_EXTENSION__manifestFile=manifest.prod.json + export SWF_CHROME_EXTENSION__routerTargetOrigin=https://kiegroup.github.io + export SWF_CHROME_EXTENSION__routerRelativePath=kogito-online-staging/${params.TAG}-prerelease/swf-chrome-extension + export SWF_CHROME_EXTENSION__manifestFile=manifest.prod.json + export ONLINE_EDITOR__buildInfo="${params.TAG} (staging) @ ${params.COMMIT_SHA}" + export ONLINE_EDITOR__extendedServicesDownloadUrlLinux=${params.DOWNLOAD_ASSET_URL}/STAGING__kie_sandbox_extended_services_linux_${params.TAG}.tar.gz + export ONLINE_EDITOR__extendedServicesDownloadUrlMacOs=${params.DOWNLOAD_ASSET_URL}/STAGING__kie_sandbox_extended_services_macos_${params.TAG}.dmg + export ONLINE_EDITOR__extendedServicesDownloadUrlWindows=${params.DOWNLOAD_ASSET_URL}/STAGING__kie_sandbox_extended_services_windows_${params.TAG}.exe + export ONLINE_EDITOR__extendedServicesCompatibleVersion=${params.TAG} + export ONLINE_EDITOR__gtmId="" + export ONLINE_EDITOR__corsProxyUrl=https://staging-cors-proxy-kie-sandbox.rhba-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud + export EXTENDED_SERVICES__kieSandboxUrl=https://kiegroup.github.io/kogito-online-staging/${params.TAG}-prerelease + export SERVERLESS_LOGIC_WEB_TOOLS__version=${params.TAG}-prerelease + export SERVERLESS_LOGIC_WEB_TOOLS__samplesRepositoryRef=${params.TAG} + export SERVERLESS_LOGIC_WEB_TOOLS__buildInfo="${params.TAG} (staging) @ ${params.COMMIT_SHA}" + export SERVERLESS_LOGIC_WEB_TOOLS__corsProxyUrl=https://staging-cors-proxy-kie-sandbox.rhba-0ad6762cc85bcef5745bb684498c2436-0000.us-south.containers.appdomain.cloud + + pnpm -F='!@kie-tools/serverless-logic-web-tools-swf-dev-mode-image' \ + -F='!@kie-tools/dmn-dev-deployment-base-image' \ + -F='!@kie-tools/serverless-logic-web-tools-base-builder-image' \ + -F='!@kie-tools/dashbuilder-viewer-image' \ + -r --workspace-concurrency=1 build:prod + """.trim() + } + } + } + + stage('STAGING: Push serverless-logic-web-tools-swf-builder-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageRegistry}/${env.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageAccount}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageName}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfBuilderImageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('STAGING: Deploy Online Editor to kogito-online-staging') { + when { + expression { !params.DRY_RUN } + } + steps { + dir('kogito-online-staging') { + script { + DEPLOYMENT_DIR = "${params.TAG}-prerelease" + + sh """#!/bin/bash -el + echo "Switch to main branch" + git checkout main + + echo "Reset deployment dir" + rm -rf ${DEPLOYMENT_DIR} + + echo "Copy Online Editor resources to the deployment dir" + cp -r ${WORKSPACE}/kie-tools/packages/online-editor/dist ${DEPLOYMENT_DIR} + + echo "Create dir for deploying KIE Editors Chrome Extension resources" + mkdir ${DEPLOYMENT_DIR}/chrome-extension + + echo "Create dir for deploying SWF Editor Chrome Extension resources" + mkdir ${DEPLOYMENT_DIR}/swf-chrome-extension + + echo "Copy KIE Editors Chrome Extension resources to the deployment directory" + cp -r ${WORKSPACE}/kie-tools/packages/chrome-extension-pack-kogito-kie-editors/dist/{bpmn,dmn,scesim,fonts,*-envelope.*} ${DEPLOYMENT_DIR}/chrome-extension + + echo "Copy SWF Editor Chrome Extension resources to the deployment directory" + cp -r ${WORKSPACE}/kie-tools/packages/chrome-extension-serverless-workflow-editor/dist/{fonts,diagram,*-envelope.*,*.bundle.js,*.worker.js} ${DEPLOYMENT_DIR}/swf-chrome-extension + + echo "Remove gwt-editors from the Online Editor deployment" + rm -rf ${DEPLOYMENT_DIR}/gwt-editors + + echo "Make the Online Editor use the resources deployed by the Chrome Extension (to save space)" + ln -s chrome-extension ${DEPLOYMENT_DIR}/gwt-editors + + echo "Commit changes and push" + git add ${params.TAG}-prerelease + git commit -m "Deploy ${params.TAG}-prerelease (staging)" + """.trim() + + withCredentials([usernamePassword(credentialsId: "${pipelineVars.kieToolsBotGithubCredentialsId}", usernameVariable: 'GH_USER', passwordVariable: 'GH_PASSWORD')]) { + sh('set +x && git push https://$GH_USER:[email protected]/kiegroup/kogito-online-staging.git main') + } + } + } + } + } + + stage('STAGING: Deploy Serverless Logic Web Tools to serverless-logic-sandbox-deployment') { + when { + expression { !params.DRY_RUN } + } + steps { + dir('serverless-logic-sandbox-deployment') { + script { + DEPLOYMENT_DIR = "staging/${params.TAG}-prerelease" + + sh """#!/bin/bash -el + echo "Switch to gh-pages branch" + git checkout gh-pages + + echo "Reset deployment dir" + rm -rf ${DEPLOYMENT_DIR} + + echo "Copy Serverless Logic Web Tools resources to the deployment dir" + cp -r ${WORKSPACE}/kie-tools/packages/serverless-logic-web-tools/dist ${DEPLOYMENT_DIR} + + echo "Commit changes and push" + git add ${DEPLOYMENT_DIR} + git commit -m "Deploy ${params.TAG}-prerelease (staging)" + """.trim() + + withCredentials([usernamePassword(credentialsId: "${pipelineVars.kieToolsBotGithubCredentialsId}", usernameVariable: 'GH_USER', passwordVariable: 'GH_PASSWORD')]) { + sh('set +x && git push https://$GH_USER:[email protected]/kiegroup/serverless-logic-sandbox-deployment.git gh-pages') + } + } + } + } + } + + stage('STAGING: Compress Online Editor (Ubuntu only)') { + steps { + dir('kie-tools/packages/online-editor') { + script { + zipUtils.zipArtifact('dist.zip', 'dist/*') + } + } + } + } + + stage('STAGING: Compress Serverless Logic Web Tools (Ubuntu only)') { + steps { + dir('kie-tools/packages/serverless-logic-web-tools') { + script { + zipUtils.zipArtifact('dist.zip', 'dist/*') + } + } + } + } + + stage('STAGING: Upload Online Editor') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/online-editor/dist.zip', + "STAGING__online_editor_${params.TAG}.zip", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Serverless Logic Web Tools') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/serverless-logic-web-tools/dist.zip', + "STAGING__serverless_logic_web_tools_${params.TAG}.zip", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension (dev)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/kie-editors-dev-vscode-extension/dist/kie_editors_dev_vscode_extension_${params.TAG}.vsix", + "STAGING__vscode_extension_dev_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - BPMN Editor (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/bpmn-vscode-extension/dist/bpmn_vscode_extension_${params.TAG}.vsix", + "STAGING__bpmn_vscode_extension_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - DMN Editor (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/dmn-vscode-extension/dist/dmn_vscode_extension_${params.TAG}.vsix", + "STAGING__dmn_vscode_extension_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - PMML Editor (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/pmml-vscode-extension/dist/pmml_vscode_extension_${params.TAG}.vsix", + "STAGING__pmml_vscode_extension_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - Serverless Workflow Editor - KIE (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/serverless-workflow-vscode-extension/dist/serverless_workflow_vscode_extension_${params.TAG}.vsix", + "STAGING__serverless_workflow_vscode_extension_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - Dashbuilder Editor (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/vscode-extension-dashbuilder-editor/dist/vscode_extension_dashbuilder_editor_${params.TAG}.vsix", + "STAGING__vscode_extension_dashbuilder_editor_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - Kogito Bundle (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/vscode-extension-kogito-bundle/dist/vscode_extension_kogito_bundle_${params.TAG}.vsix", + "STAGING__vscode_extension_kogito_bundle_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload VS Code Extension - KIE Business Automation Bundle (prod)') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/vscode-extension-kie-ba-bundle/dist/vscode_extension_kie_ba_bundle_${params.TAG}.vsix", + "STAGING__vscode_extension_kie_ba_bundle_${params.TAG}.vsix", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Chrome Extension for KIE Editors') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/chrome-extension-pack-kogito-kie-editors/dist/chrome_extension_kogito_kie_editors_${params.TAG}.zip", + "STAGING__chrome_extension_kogito_kie_editors_${params.TAG}.zip", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Chrome Extension for Serverless Workflow Editor') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + "kie-tools/packages/chrome-extension-serverless-workflow-editor/dist/chrome_extension_serverless_workflow_editor_${params.TAG}.zip", + "STAGING__chrome_extension_serverless_workflow_editor_${params.TAG}.zip", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Extended Services for Linux') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/extended-services/dist/linux/kie_sandbox_extended_services.tar.gz', + "STAGING__kie_sandbox_extended_services_linux_${params.TAG}.tar.gz", + 'application/zip', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + // STAGING: Upload Extended Services for macOS (macOS only) + // STAGING: Upload Extended Services for Windows (Windows only) + + stage('STAGING: Upload Knative CLI Workflow Plugin for Linux') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/kn-plugin-workflow/dist/kn-workflow-linux-amd64', + "STAGING__kn-workflow-linux-amd64-${params.TAG}", + 'application/octet-stream', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Knative CLI Workflow Plugin for macOS') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/kn-plugin-workflow/dist/kn-workflow-darwin-amd64', + "STAGING__kn-workflow-darwin-amd64-${params.TAG}", + 'application/octet-stream', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Knative CLI Workflow Plugin for macOS M1') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/kn-plugin-workflow/dist/kn-workflow-darwin-arm64', + "STAGING__kn-workflow-darwin-arm64-${params.TAG}", + 'application/octet-stream', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Upload Knative CLI Workflow Plugin for Windows') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + githubUtils.uploadReleaseAsset( + "${params.UPLOAD_ASSET_URL}", + 'kie-tools/packages/kn-plugin-workflow/dist/kn-workflow-windows-amd64.exe', + "STAGING__kn-workflow-windows-amd64-${params.TAG}.exe", + 'application/octet-stream', + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + } + } + } + + stage('STAGING: Push kie-sandbox-extended-services-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.KIE_SANDBOX_EXTENDED_SERVICES__imageRegistry}/${env.KIE_SANDBOX_EXTENDED_SERVICES__imageAccount}", + "${env.KIE_SANDBOX_EXTENDED_SERVICES__imageName}", + "${env.KIE_SANDBOX_EXTENDED_SERVICES__imageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('STAGING: Deploy kie-sandbox-extended-services-image to OpenShift') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + appName = 'staging-kie-sandbox-extended-services' + openShiftUtils.createOrUpdateApp( + "${env.OPENSHIFT_NAMESPACE}", + "${appName}", + "${env.DEPLOY_TAG}", + "${env.KIE_SANDBOX_EXTENDED_SERVICES__imageRegistry}/${env.KIE_SANDBOX_EXTENDED_SERVICES__imageAccount}/${env.KIE_SANDBOX_EXTENDED_SERVICES__imageName}:${env.DEPLOY_TAG}", + "${env.OPENSHIFT_PART_OF}", + 'golang', + "${pipelineVars.openshiftCredentialsId}" + ) + env.KIE_SANDBOX_EXTENDED_SERVICES_URL = openShiftUtils.getAppRoute("${env.OPENSHIFT_NAMESPACE}", "${appName}", "${pipelineVars.openshiftCredentialsId}") + } + } + } + + stage('STAGING: Push cors-proxy-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.CORS_PROXY_IMAGE__imageRegistry}/${env.CORS_PROXY_IMAGE__imageAccount}", + "${env.CORS_PROXY_IMAGE__imageName}", + "${env.CORS_PROXY_IMAGE__imageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('STAGING: Deploy cors-proxy-image to OpenShift') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + appName = 'staging-cors-proxy' + openShiftUtils.createOrUpdateApp( + "${env.OPENSHIFT_NAMESPACE}", + "${appName}", + "${env.DEPLOY_TAG}", + "${env.CORS_PROXY_IMAGE__imageRegistry}/${env.CORS_PROXY_IMAGE__imageAccount}/${env.CORS_PROXY_IMAGE__imageName}:${env.DEPLOY_TAG}", + "${env.OPENSHIFT_PART_OF}", + 'nodejs', + "${pipelineVars.openshiftCredentialsId}" + ) + env.KIE_SANDBOX_CORS_PROXY_URL = openShiftUtils.getAppRoute("${env.OPENSHIFT_NAMESPACE}", "${appName}", "${pipelineVars.openshiftCredentialsId}") + } + } + } + + stage('STAGING: Push kie-sandbox-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.KIE_SANDBOX__imageRegistry}/${env.KIE_SANDBOX__imageAccount}", + "${env.KIE_SANDBOX__imageName}", + "${env.KIE_SANDBOX__imageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('STAGING: Prepare environment variables for OpenShift deployment') { + when { + expression { !params.DRY_RUN } + } + steps { + sh """#!/bin/bash -el + echo "KIE_SANDBOX_EXTENDED_SERVICES_URL=${env.KIE_SANDBOX_EXTENDED_SERVICES_URL}" >> deployment.env + echo "KIE_SANDBOX_CORS_PROXY_URL=${env.KIE_SANDBOX_CORS_PROXY_URL}" >> deployment.env + """.trim() + } + } + + stage('STAGING: Deploy kie-sandbox-image to OpenShift') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + openShiftUtils.createOrUpdateApp( + "${env.OPENSHIFT_NAMESPACE}", + 'staging-kie-sandbox', + "${env.DEPLOY_TAG}", + "${env.KIE_SANDBOX__imageRegistry}/${env.KIE_SANDBOX__imageAccount}/${env.KIE_SANDBOX__imageName}:${env.DEPLOY_TAG}", + "${env.OPENSHIFT_PART_OF}", + 'js', + "${pipelineVars.openshiftCredentialsId}", + './deployment.env' + ) + } + } + } + + stage('Build (serverless-logic-web-tools-swf-dev-mode-image)') { + steps { + dir('kie-tools') { + sh '''#!/bin/bash -el + export KIE_TOOLS_BUILD__runTests=true + export KIE_TOOLS_BUILD__buildContainerImages=true + docker system prune -af + echo "Build @kie-tools/serverless-logic-web-tools-swf-dev-mode-image" + pnpm -F @kie-tools/serverless-logic-web-tools-swf-dev-mode-image... --workspace-concurrency=1 build:prod + '''.trim() + } + } + } + + stage('STAGING: Push serverless-logic-web-tools-swf-dev-mode-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageRegistry}/${env.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageAccount}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageName}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('Build (dmn-dev-deployment-base-image)') { + steps { + dir('kie-tools') { + sh '''#!/bin/bash -el + export KIE_TOOLS_BUILD__runTests=true + export KIE_TOOLS_BUILD__buildContainerImages=true + docker system prune -af + echo "Build @kie-tools/dmn-dev-deployment-base-image" + pnpm -F @kie-tools/dmn-dev-deployment-base-image... --workspace-concurrency=1 build:prod + '''.trim() + } + } + } + + stage('STAGING: Push dmn-dev-deployment-base-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.DMN_DEV_DEPLOYMENT_BASE_IMAGE__registry}/${env.DMN_DEV_DEPLOYMENT_BASE_IMAGE__account}", + "${env.DMN_DEV_DEPLOYMENT_BASE_IMAGE__name}", + "${env.DMN_DEV_DEPLOYMENT_BASE_IMAGE__buildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('Build (serverless-logic-web-tools-base-builder-image)') { + steps { + dir('kie-tools') { + sh '''#!/bin/bash -el + export KIE_TOOLS_BUILD__runTests=true + export KIE_TOOLS_BUILD__buildContainerImages=true + docker system prune -af + echo "Build @kie-tools/serverless-logic-web-tools-base-builder-image" + pnpm -F @kie-tools/serverless-logic-web-tools-base-builder-image... --workspace-concurrency=1 build:prod + '''.trim() + } + } + } + + stage('STAGING: Push serverless-logic-web-tools-base-builder-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageRegistry}/${env.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageAccount}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageName}", + "${env.SERVERLESS_LOGIC_WEB_TOOLS__baseBuilderImageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + + stage('Build (dashbuilder-viewer-image)') { + steps { + dir('kie-tools') { + sh '''#!/bin/bash -el + export KIE_TOOLS_BUILD__runTests=true + export KIE_TOOLS_BUILD__buildContainerImages=true + docker system prune -af + echo "Build @kie-tools/dashbuilder-viewer-image" + pnpm -F @kie-tools/dashbuilder-viewer-image... --workspace-concurrency=1 build:prod + '''.trim() + } + } + } + + stage('STAGING: Push dashbuilder-viewer-image to quay.io') { + when { + expression { !params.DRY_RUN } + } + steps { + script { + dockerUtils.pushImageToRegistry( + "${env.DASHBUILDER__viewerImageRegistry}/${env.DASHBUILDER__viewerImageAccount}", + "${env.DASHBUILDER__viewerImageName}", + "${env.DASHBUILDER__viewerImageBuildTags}", + "${pipelineVars.quayPushCredentialsId}" + ) + } + } + } + } + + post { + always { + cleanWs(deleteDirs: true) + } + } +} diff --git a/.ci/jenkins/Jenkinsfile.staging-dry-run b/.ci/jenkins/Jenkinsfile.staging-dry-run new file mode 100644 index 0000000000..dc8d3caaa5 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.staging-dry-run @@ -0,0 +1,44 @@ +/* + * 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 'quay.io/kie-tools/kie-tools-ci-build:latest' + } + } + + options { + timeout(time: 240, unit: 'MINUTES') + } + + stages { + stage('Staging Build (dry run)') { + steps { + build job: 'KIE/kie-tools/kie-tools-staging-build', parameters: [ + booleanParam(name: 'DRY_RUN', value: true), + string(name: 'BASE_REF', value: 'main') + ] + } + } + } + + post { + always { + cleanWs(deleteDirs: true) + } + } +} diff --git a/.ci/jenkins/Jenkinsfile.staging-publish b/.ci/jenkins/Jenkinsfile.staging-publish new file mode 100644 index 0000000000..fe5e9c3aa3 --- /dev/null +++ b/.ci/jenkins/Jenkinsfile.staging-publish @@ -0,0 +1,123 @@ +/* + * 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 'quay.io/kie-tools/kie-tools-ci-build:latest' + } + } + + options { + timeout(time: 240, unit: 'MINUTES') + } + + stages { + stage('Load local shared scripts') { + steps { + script { + pipelineVars = load '.ci/jenkins/shared-scripts/pipelineVars.groovy' + githubUtils = load '.ci/jenkins/shared-scripts/githubUtils.groovy' + } + } + } + + stage('Clean workspace before build') { + steps { + cleanWs(deleteDirs: true, disableDeferredWipeout: true) + } + } + + stage('Checkout kie-tools') { + steps { + dir('kie-tools') { + checkout scm + } + } + } + + stage('Parse `tag`') { + steps { + dir('kie-tools') { + script { + env.TAG = sh(returnStdout: true, script: "#!/bin/bash -el \n node -p \"'\${GIT_BRANCH}'.match(/(.+)-prerelease/)[1]\"").trim() + env.PACKAGE_VERSION = sh(returnStdout: true, script: "#!/bin/bash -el \n node -p \"require('./package.json').version\"").trim() + env.COMMIT_SHA = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() + } + } + } + } + + stage('Check `tag` against `package.json.version`') { + steps { + dir('kie-tools') { + sh """#!/bin/bash -el + [[ "${env.TAG}" == "${env.PACKAGE_VERSION}" ]] + """.trim() + } + } + } + + stage('Create Release (draft)') { + steps { + script { + response = githubUtils.createRelease( + "${pipelineVars.githubRepositorySlug}", + "${env.TAG} @ (alpha)", + "${env.TAG}", + "${env.COMMIT_SHA}", + true, + true, + "${pipelineVars.kieToolsBotGithubTokenCredentialsId}" + ) + + respJSON = readJSON text: response + + env.RELEASE_ID = respJSON.id + env.RELEASE_HTML_URL = respJSON.html_url + env.RELEASE_UPLOAD_ASSET_URL = githubUtils.parseReleaseAssetUploadUrl(respJSON.upload_url) + } + } + } + + stage('Generate download URL for Release assets') { + steps { + script { + env.RELEASE_DOWNLOAD_ASSET_URL = sh(returnStdout: true, script: "echo ${env.RELEASE_HTML_URL} | sed \"s#/tag/#/download/#\"").trim() + } + } + } + + stage('Staging Build and Publish') { + steps { + build job: 'KIE/kie-tools/kie-tools-staging-build', parameters: [ + booleanParam(name: 'DRY_RUN', value: false), + string(name: 'BASE_REF', value: "${GIT_BRANCH}"), + string(name: 'TAG', value: "${env.TAG}"), + string(name: 'COMMIT_SHA', value: "${env.COMMIT_SHA}"), + string(name: 'DOWNLOAD_ASSET_URL', value: "${env.RELEASE_DOWNLOAD_ASSET_URL}"), + string(name: 'UPLOAD_ASSET_URL', value: "${env.RELEASE_UPLOAD_ASSET_URL}") + ] + } + } + } + + post { + always { + cleanWs(deleteDirs: true) + } + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
