Skip to content

NO-ISSUE: Fix publishing KIE Sandbox helm chart to Docker Hub #2459

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

Merged
merged 3 commits into from
Jul 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
3 changes: 2 additions & 1 deletion .ci/jenkins/Jenkinsfile.daily-dev-publish
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ pipeline {
dir('kie-tools') {
script {
helmUtils.pushChartToRegistry(
"${env.KIE_SANDBOX_HELM_CHART__registry}/${env.KIE_SANDBOX_HELM_CHART__account}",
"${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.dockerHubUserCredentialsId}",
"${pipelineVars.dockerHubTokenCredentialsId}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ pipeline {
dir('kie-tools') {
script {
helmUtils.pushChartToRegistry(
"${env.KIE_SANDBOX_HELM_CHART__registry}/${env.KIE_SANDBOX_HELM_CHART__account}",
"${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.dockerHubUserCredentialsId}",
"${pipelineVars.dockerHubTokenCredentialsId}"
Expand Down
6 changes: 3 additions & 3 deletions .ci/jenkins/shared-scripts/dockerUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
* Push an image to a given registry
*/
def pushImageToRegistry(String registry, String account, String image, String tags, String userCredentialsId, String tokenCredentialsId) {
withCredentials([string(credentialsId: userCredentialsId, variable: 'DOCKER_USER')]) {
withCredentials([string(credentialsId: tokenCredentialsId, variable: 'DOCKER_TOKEN')]) {
withCredentials([string(credentialsId: userCredentialsId, variable: 'REGISTRY_USER')]) {
withCredentials([string(credentialsId: tokenCredentialsId, variable: 'REGISTRY_TOKEN')]) {
sh """
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USER}" --password-stdin $registry
echo "${REGISTRY_TOKEN}" | docker login -u "${REGISTRY_USER}" --password-stdin $registry
""".trim()
tagList = tags.split(' ')
for (tag in tagList) {
Expand Down
14 changes: 9 additions & 5 deletions .ci/jenkins/shared-scripts/helmUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@
/**
* 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}"
def pushChartToRegistry(String registry, String account, String chart, String userCredentialsId, String tokenCredentialsId) {
withCredentials([string(credentialsId: userCredentialsId, variable: 'REGISTRY_USER')]) {
withCredentials([string(credentialsId: tokenCredentialsId, variable: 'REGISTRY_TOKEN')]) {
sh """
echo "${REGISTRY_TOKEN}" | helm registry login -u "${REGISTRY_USER}" --password-stdin $registry
helm push ${chart} oci://${registry}/${account}
helm registry logout ${registry}
""".trim()
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/kie-sandbox-helm-chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,27 @@ Very similar to the way you install the chart from source code, you can also ins
### Default install

```console
$ helm install kie-sandbox oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0
$ helm install kie-sandbox oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0-main
```

### Minikube install

```console
$ helm pull oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0 --untar
$ helm pull oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0-main --untar
$ helm install kie-sandbox ./kie-sandbox-helm-chart --values ./kie-sandbox-helm-chart/values-minikube-nginx.yaml
```

### Kubernetes install

```console
$ helm pull oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0 --untar
$ helm pull oci://docker.io/apache/incubator-kie-sandbox-helm-chart --version=0.0.0-main --untar
$ helm install kie-sandbox ./kie-sandbox-helm-chart --values ./kie-sandbox-helm-chart/values-kubernetes.yaml --set global.kubernetesClusterDomain="<YOUR_KUBERNETES_CLUSTER_DOMAIN>" --set global.kubernetesIngressClass="<YOUR_KUBERNETES_INGRESS_CLASS>"
```

### OpenShift install

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

Expand Down
3 changes: 3 additions & 0 deletions packages/kie-sandbox-helm-chart/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const chartFiles = [
];
chartFiles.forEach((file) => {
const doc = yaml.parseDocument(fs.readFileSync(file, "utf8"));
if (file == "src/Chart.yaml") {
doc.setIn(["name"], env.kieSandboxHelmChart.name);
}
doc.setIn(["version"], env.kieSandboxHelmChart.tag);
doc.setIn(["appVersion"], env.kieSandboxHelmChart.tag);
if (doc.getIn(["dependencies"])) {
Expand Down
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: incubator-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
2 changes: 1 addition & 1 deletion packages/kie-sandbox-helm-chart/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
under the License.
-->

# kie-sandbox-helm-chart
# incubator-kie-sandbox-helm-chart

![Version: 0.0.0](https://img.shields.io/badge/Version-0.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)

Expand Down
Loading