Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-issues#802: KIE Sandbox Helm Chart staging, release and publish Jenkins jobs #2107

Merged
merged 5 commits into from
Jan 4, 2024
Merged
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
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.daily-dev-publish
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ pipeline {
ln -s editors dev/gwt-editors
git add . && git commit -m "Apache KIE Tools Daily Dev Build resources - ${env.BUILD_DATE}" || echo 'No changes.'
""".trim()

githubUtils.pushObject('origin', 'gh-pages', "${pipelineVars.asfGithubPushCredentialsId}")
}
}
Expand Down
23 changes: 22 additions & 1 deletion .ci/jenkins/Jenkinsfile.release-build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {
string(description: 'Base Ref', name: 'BASE_REF')
string(description: 'Tag', name: 'TAG', defaultValue: '0.0.0')
string(description: 'Upload asset url', name: 'UPLOAD_ASSET_URL', defaultValue: '')
string(description: 'Runners', name: 'RUNNERS', defaultValue: '{"dev_deployment_base_image":"false","dev_deployment_dmn_form_webapp_image":"false","kie_sandbox_image":"false","kie_sandbox_extended_services_image":"false","cors_proxy_image":"false","online_editor":"false","chrome_extensions":"false","vscode_extensions_dev":"false","vscode_extensions_prod":"false","npm_packages":"false","standalone_editors_cdn":"false","extended_services":"false","serverless_logic_web_tools":"false","serverless_logic_web_tools_swf_builder_image":"false","serverless_logic_web_tools_base_builder_image":"false","serverless_logic_web_tools_swf_dev_mode_image":"false","dashbuilder_viewer_image":"false","kn_plugin_workflow":"false"}')
string(description: 'Runners', name: 'RUNNERS', defaultValue: '{"dev_deployment_base_image":"false","dev_deployment_dmn_form_webapp_image":"false","kie_sandbox_image":"false","kie_sandbox_extended_services_image":"false","cors_proxy_image":"false","online_editor":"false","chrome_extensions":"false","vscode_extensions_dev":"false","vscode_extensions_prod":"false","npm_packages":"false","standalone_editors_cdn":"false","extended_services":"false","serverless_logic_web_tools":"false","serverless_logic_web_tools_swf_builder_image":"false","serverless_logic_web_tools_base_builder_image":"false","serverless_logic_web_tools_swf_dev_mode_image":"false","dashbuilder_viewer_image":"false","kn_plugin_workflow":"false","kie_sandbox_helm_chart":"true"}')
}

environment {
Expand Down Expand Up @@ -82,6 +82,7 @@ pipeline {
env.SERVERLESS_LOGIC_WEB_TOOLS_SWF_DEV_MODE_IMAGE = runners.serverless_logic_web_tools_swf_dev_mode_image
env.DASHBUILDER_VIEWER_IMAGE = runners.dashbuilder_viewer_image
env.KN_PLUGIN_WORKFLOW = runners.kn_plugin_workflow
env.KIE_SANDBOX_HELM_CHART = runners.kie_sandbox_helm_chart
}
}
}
Expand All @@ -107,6 +108,7 @@ pipeline {
echo "serverless_logic_web_tools_swf_dev_mode_image: ${env.SERVERLESS_LOGIC_WEB_TOOLS_SWF_DEV_MODE_IMAGE}"
echo "dashbuilder_viewer_image: ${env.DASHBUILDER_VIEWER_IMAGE}"
echo "kn_plugin_workflow: ${env.KN_PLUGIN_WORKFLOW}"
echo "kie_sandbox_helm_chart: ${env.KIE_SANDBOX_HELM_CHART}"
""".trim()
}
}
Expand Down Expand Up @@ -466,6 +468,25 @@ pipeline {
}
}
}

stage('KIE Sandbox Helm Chart') {
when {
expression { env.KIE_SANDBOX_HELM_CHART == 'true' }
}
steps {
script {
env.KIE_SANDBOX_HELM_CHART_JOB_RESULT = build(
wait: true,
job: 'KIE/kie-tools/kie-tools-release-jobs/kie-sandbox-helm-chart',
parameters: [
booleanParam(name: 'DRY_RUN', value: "${params.DRY_RUN}"),
string(name: 'BASE_REF', value: "${params.BASE_REF}"),
string(name: 'TAG', value: "${params.TAG}")
]
).result
}
}
}
}

post {
Expand Down
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.release-dry-run
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pipeline {
build job: 'KIE/kie-tools/kie-tools-release-build', parameters: [
booleanParam(name: 'DRY_RUN', value: true),
string(name: 'BASE_REF', value: 'main'),
string(name: 'RUNNERS', value: '{"dev_deployment_base_image":"true","dev_deployment_dmn_form_webapp_image":"true","kie_sandbox_image":"true","kie_sandbox_extended_services_image":"true","cors_proxy_image":"true","online_editor":"true","chrome_extensions":"true","vscode_extensions_dev":"true","vscode_extensions_prod":"true","npm_packages":"true","standalone_editors_cdn":"true","extended_services":"true","serverless_logic_web_tools":"true","serverless_logic_web_tools_swf_builder_image":"true","serverless_logic_web_tools_base_builder_image":"true","serverless_logic_web_tools_swf_dev_mode_image":"true","dashbuilder_viewer_image":"true","kn_plugin_workflow":"true"}')
string(name: 'RUNNERS', value: '{"dev_deployment_base_image":"true","dev_deployment_dmn_form_webapp_image":"true","kie_sandbox_image":"true","kie_sandbox_extended_services_image":"true","cors_proxy_image":"true","online_editor":"true","chrome_extensions":"true","vscode_extensions_dev":"true","vscode_extensions_prod":"true","npm_packages":"true","standalone_editors_cdn":"true","extended_services":"true","serverless_logic_web_tools":"true","serverless_logic_web_tools_swf_builder_image":"true","serverless_logic_web_tools_base_builder_image":"true","serverless_logic_web_tools_swf_dev_mode_image":"true","dashbuilder_viewer_image":"true","kn_plugin_workflow":"true","kie_sandbox_helm_chart":"true"}')
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion .ci/jenkins/Jenkinsfile.release-publish
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pipeline {

parameters {
string(description: 'Tag', name: 'TAG', defaultValue: '0.0.0')
string(description: 'Runners', name: 'RUNNERS', defaultValue: '{"dev_deployment_base_image":"true","dev_deployment_dmn_form_webapp_image":"true","kie_sandbox_image":"true","kie_sandbox_extended_services_image":"true","cors_proxy_image":"true","online_editor":"true","chrome_extensions":"true","vscode_extensions_dev":"true","vscode_extensions_prod":"true","npm_packages":"true","standalone_editors_cdn":"true","extended_services":"true","serverless_logic_web_tools":"true","serverless_logic_web_tools_swf_builder_image":"true","serverless_logic_web_tools_base_builder_image":"true","serverless_logic_web_tools_swf_dev_mode_image":"true","dashbuilder_viewer_image":"true","kn_plugin_workflow":"true"}')
string(description: 'Runners', name: 'RUNNERS', defaultValue: '{"dev_deployment_base_image":"true","dev_deployment_dmn_form_webapp_image":"true","kie_sandbox_image":"true","kie_sandbox_extended_services_image":"true","cors_proxy_image":"true","online_editor":"true","chrome_extensions":"true","vscode_extensions_dev":"true","vscode_extensions_prod":"true","npm_packages":"true","standalone_editors_cdn":"true","extended_services":"true","serverless_logic_web_tools":"true","serverless_logic_web_tools_swf_builder_image":"true","serverless_logic_web_tools_base_builder_image":"true","serverless_logic_web_tools_swf_dev_mode_image":"true","dashbuilder_viewer_image":"true","kn_plugin_workflow":"true","kie_sandbox_helm_chart":"true"}')
}

stages {
Expand Down
25 changes: 24 additions & 1 deletion .ci/jenkins/Jenkinsfile.staging-build
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ pipeline {
SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageTag = "${params.TAG}-prerelease"
SERVERLESS_LOGIC_WEB_TOOLS__swfDevModeImageBuildTags = "${params.TAG}-prerelease"

KIE_SANDBOX_HELM_CHART__registry = 'quay.io'
KIE_SANDBOX_HELM_CHART__account = 'kie-tools'
KIE_SANDBOX_HELM_CHART__name = 'kie-sandbox-helm-chart'
KIE_SANDBOX_HELM_CHART__tag = "${params.TAG}-prerelease"

DOCKER_CONFIG = "${WORKSPACE}/.docker"
}

Expand All @@ -106,6 +111,7 @@ pipeline {
githubUtils = load '.ci/jenkins/shared-scripts/githubUtils.groovy'
openShiftUtils = load '.ci/jenkins/shared-scripts/openShiftUtils.groovy'
dockerUtils = load '.ci/jenkins/shared-scripts/dockerUtils.groovy'
helmUtils = load '.ci/jenkins/shared-scripts/helmUtils.groovy'
zipUtils = load '.ci/jenkins/shared-scripts/zipUtils.groovy'
}
}
Expand Down Expand Up @@ -795,6 +801,23 @@ pipeline {
}
}
}

stage('STAGING: Push kie-sandbox-helm-chart to quay.io') {
when {
expression { !params.DRY_RUN }
}
steps {
dir('kie-tools') {
script {
helmUtils.pushChartToRegistry(
"${env.KIE_SANDBOX_HELM_CHART__registry}/${env.KIE_SANDBOX_HELM_CHART__account}",
"packages/kie-sandbox-helm-chart/dist/${env.KIE_SANDBOX_HELM_CHART__name}-${env.KIE_SANDBOX_HELM_CHART__tag}.tgz",
"${pipelineVars.quayPushCredentialsId}"
)
}
}
}
}
}

post {
Expand Down Expand Up @@ -848,7 +871,7 @@ def deployOnlineEditor(String tag, String credentialsId) {
sh """#!/bin/bash -el
git config user.email asf-ci-kie@jenkins.kie.apache.org
git config user.name asf-ci-kie

echo "Switch to main branch"
git checkout main

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ pipeline {
KIE_TOOLS_BUILD__runEndToEndTests = 'false'
KIE_TOOLS_BUILD__buildContainerImages = 'true'

KIE_SANDBOX_HELM_CHART__registry = 'quay.io'
KIE_SANDBOX_HELM_CHART__account = 'kie-tools'
KIE_SANDBOX_HELM_CHART__name = 'kie-sandbox-helm-chart'
KIE_SANDBOX_HELM_CHART__tag = "${params.TAG}"

DOCKER_CONFIG = "${WORKSPACE}/.docker"

PNPM_FILTER_STRING = '-F @kie-tools/kie-sandbox-helm-chart...'
Expand All @@ -50,7 +55,7 @@ pipeline {
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'
hemlUtils = load '.ci/jenkins/shared-scripts/helmUtils.groovy'
}
}
}
Expand Down Expand Up @@ -113,6 +118,22 @@ pipeline {
}
}

stage('Push kie-sandbox-helm-chart to quay.io') {
when {
expression { !params.DRY_RUN }
}
steps {
dir('kie-tools') {
script {
helmUtils.pushChartToRegistry(
"${env.KIE_SANDBOX_HELM_CHART__registry}/${env.KIE_SANDBOX_HELM_CHART__account}",
"packages/kie-sandbox-helm-chart/dist/${env.KIE_SANDBOX_HELM_CHART__name}-${env.KIE_SANDBOX_HELM_CHART__tag}.tgz",
"${pipelineVars.quayPushCredentialsId}"
)
}
}
}
}
}

post {
Expand Down
29 changes: 29 additions & 0 deletions .ci/jenkins/shared-scripts/helmUtils.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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.
*/

/**
* Push a Helm Chart to a given registry
*/
def pushChartToRegistry(String registry, String chart, String credentialsId) {
withCredentials([usernamePassword(credentialsId: credentialsId, usernameVariable: 'REGISTRY_USER', passwordVariable: 'REGISTRY_PWD')]) {
sh "set +x && helm registry login -u $REGISTRY_USER -p $REGISTRY_PWD $registry"
sh "helm push ${chart} oci://${registry}"
sh "helm registry logout ${registry}"
}
}

return this;
26 changes: 25 additions & 1 deletion packages/kie-sandbox-helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ If you don't have access rigths to this config, try creating a dummy Route resou
To install the chart with the release name `kie-sandbox`:

```console
$ helm install kie-sandbox ./src --values ./src/values-openshift.yaml --set global.ocpRouteDomain=<YOUR_OCP_ROUTE_DOMAIN>
$ helm install kie-sandbox ./src --values ./src/values-openshift.yaml --set global.openshiftRouteDomain="<YOUR_OCP_ROUTE_DOMAIN>"
```

Following message should be displayed on your console.
Expand All @@ -121,6 +121,30 @@ NOTES:

No need to run any commands. KIE Sandbox should be accessible via https://kie-sandbox.<YOUR_OCP_ROUTE_DOMAIN>

## Installing a released version from the OCI registry:

Very similar to the way you install the chart from source code, you can also install a released version available on quay.io registry:

### Default install

```console
$ helm install kie-sandbox oci://quay.io/kie-tools/kie-sandbox-helm-chart --version=0.0.0
```

### Minikube install

```console
$ helm pull oci://quay.io/kie-tools/kie-sandbox-helm-chart --version=0.0.0 --untar
$ helm install kie-sandbox ./kie-sandbox-helm-chart --values ./kie-sandbox-helm-chart/values-minikube-nginx.yaml
```

### OpenShift install

```console
$ helm pull oci://quay.io/kie-tools/kie-sandbox-helm-chart --version=0.0.0 --untar
$ helm install kie-sandbox ./kie-sandbox-helm-chart --values ./kie-sandbox-helm-chart/values-openshift.yaml --set global.openshiftRouteDomain="<YOUR_OCP_ROUTE_DOMAIN>"
```

## Uninstalling the Chart

To uninstall the `kie-sandbox` deployment:
Expand Down
2 changes: 1 addition & 1 deletion packages/kie-sandbox-helm-chart/src/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ dependencies:
repository: ""
version: 0.0.0
digest: sha256:ee1b087ee299c43fb848d512e5b4c97f914dc2f6d3bd45294f64b7d06006a84f
generated: "2023-12-20T20:56:48.318416177-03:00"
generated: "2024-01-02T16:33:11.063426-03:00"
2 changes: 1 addition & 1 deletion packages/kie-sandbox-helm-chart/src/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: kie_sandbox_helm_chart
name: kie-sandbox-helm-chart
description: A Helm chart to deploy KIE Sandbox and related services on Kubernetes
type: application
version: 0.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: kie-sandbox
# -- Env variables for KIE Sandbox deployment
env:
- name: "KIE_SANDBOX_EXTENDED_SERVICES_URL"
value: http://127.0.0.1:21345"
value: "http://127.0.0.1:21345"
- name: "KIE_SANDBOX_CORS_PROXY_URL"
value: "http://127.0.0.1:8081"

Expand Down
6 changes: 3 additions & 3 deletions packages/kie-sandbox-helm-chart/src/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ In order to get KIE Sandbox running you need to run these commands:
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cors_proxy.fullname" .Subcharts.cors_proxy }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.cors_proxy.service.port }}
{{- else if contains "ClusterIP" .Values.cors_proxy.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "name" . }},app.kubernetes.io/component={{ .Values.cors_proxy.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/component={{ .Values.cors_proxy.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "CORS Proxy URL: http://127.0.0.1:8081"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8081:$CONTAINER_PORT
Expand Down Expand Up @@ -51,7 +51,7 @@ In order to get KIE Sandbox running you need to run these commands:
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "extended_services.fullname" .Subcharts.extended_services }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.extended_services.service.port }}
{{- else if contains "ClusterIP" .Values.extended_services.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "name" . }},app.kubernetes.io/component={{ .Values.extended_services.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/component={{ .Values.extended_services.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Extended Services URL: http://127.0.0.1:21345"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 21345:$CONTAINER_PORT
Expand Down Expand Up @@ -79,7 +79,7 @@ In order to get KIE Sandbox running you need to run these commands:
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "kie_sandbox.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.kie_sandbox.service.port }}
{{- else if contains "ClusterIP" .Values.kie_sandbox.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "name" . }},app.kubernetes.io/component={{ .Values.kie_sandbox.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/component={{ .Values.kie_sandbox.name }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "KIE Sandbox URL http://127.0.0.1:8080"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
Loading