Merge branch 'develop' into main

develop
Nikita Tokarchuk 3 years ago
commit 580f7f15f8
Signed by: mainnika
GPG Key ID: A595FB7E3E56911C
  1. 14
      .github/workflows/image-make-and-publish.yml
  2. 86
      .jenkins/Jenkinsfile

@ -85,3 +85,17 @@ jobs:
env: env:
COSIGN_EXPERIMENTAL: "true" COSIGN_EXPERIMENTAL: "true"
run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }} run: cosign sign ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build-and-push.outputs.digest }}
- name: Trigger release job
if: ${{ success() && github.ref_name == 'main' && github.event_name != 'pull_request' && !github.event.repository.private }}
uses: toptal/jenkins-job-trigger-action@master
with:
jenkins_url: ${{ secrets.JENKINS_URL }}
jenkins_user: ${{ secrets.JENKINS_USER }}
jenkins_token: ${{ secrets.JENKINS_TOKEN }}
job_name: "nikita-tokarch-uk/job/make-a-release"
job_params: |
{
"VERSION": "${{ steps.calver.outputs.current }}"
}
job_timeout: "300" # Default 30 sec. (optional)

@ -0,0 +1,86 @@
def HELM_DOWNLOAD_URL = "https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz"
def WS_BIN = ".bin"
def WS_SCM = ".scm"
pipeline {
agent { label "k8s" }
parameters {
string(
name: "VERSION",
defaultValue: "main",
description: "version to release",
)
string(
name: "RELEASE_NAME",
defaultValue: "nikita-tokarch-uk",
description: "release name",
)
string(
name: "RELEASE_NAMESPACE",
defaultValue: "nikita-tokarch-uk",
description: "release namespace",
)
password(
name: "CREDENTIALS_ID",
defaultValue: "nikita-tokarch-uk-config",
description: "release configuration",
)
}
stages {
stage("Prepare Tools") {
when {
not {
expression { return fileExists("${WS_BIN}/linux-amd64/helm") }
}
}
steps {
dir("${WS_BIN}") {
sh """
curl -fsSL -O "${HELM_DOWNLOAD_URL}";
tar xfz *;
rm -f *;
ls -lah ./linux-amd64/helm;
"""
}
}
}
stage("Checkout") {
steps {
dir("${WS_SCM}") {
deleteDir()
checkout scm
}
}
}
stage("Make chart package") {
steps {
dir("${WS_SCM}/chart.tgz") {
sh """
"${env.WORKSPACE}/${WS_BIN}/linux-amd64/helm" package ../chart \
--app-version ${params.VERSION} \
;
"""
}
}
}
stage("Release packaged chart") {
steps {
withCredentials([file(credentialsId: "${params.CREDENTIALS_ID}", variable: "RELEASE_CONFIG")]) {
dir("${WS_SCM}/chart.tgz") {
sh """
"${env.WORKSPACE}/${WS_BIN}/linux-amd64/helm" upgrade ${params.RELEASE_NAME} * \
--namespace ${params.RELEASE_NAMESPACE} \
--create-namespace \
--dependency-update \
--reset-values \
-f "\$RELEASE_CONFIG" \
;
"""
}
}
}
}
}
}
Loading…
Cancel
Save