Update Jenkinsfile
All checks were successful
InnoHub Processor/tatort/pipeline/head This commit looks good
All checks were successful
InnoHub Processor/tatort/pipeline/head This commit looks good
This commit is contained in:
33
Jenkinsfile
vendored
33
Jenkinsfile
vendored
@@ -86,29 +86,42 @@ pipeline {
|
||||
branch 'development'
|
||||
}
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'JenkinsGitea', usernameVariable: 'GIT_USER', passwordVariable: 'GIT_PAT')]) {
|
||||
withCredentials([
|
||||
usernamePassword(
|
||||
credentialsId: 'JenkinsGitea',
|
||||
usernameVariable: 'GIT_USER',
|
||||
passwordVariable: 'GIT_PAT'
|
||||
)
|
||||
]) {
|
||||
script {
|
||||
def newTag = "0.${env.BUILD_ID}"
|
||||
def chartRepo = "https://${GIT_USER}:${GIT_PAT}@gitea.innovation-hub-niedersachsen.de/innohub/charts.git"
|
||||
def chartPath = "tatort-dev/tatort"
|
||||
def chartDir = "charts-tmp/${chartPath}"
|
||||
|
||||
sh """
|
||||
# Clean clone
|
||||
set -e
|
||||
|
||||
rm -rf charts-tmp
|
||||
git clone ${chartRepo} charts-tmp
|
||||
cd charts-tmp/${chartPath}
|
||||
cd ${chartDir}
|
||||
|
||||
# Update values.yaml image tag
|
||||
echo "[INFO] Updating values.yaml and Chart.yaml..."
|
||||
sed -i 's/^ tag: .*/ tag: ${newTag}/' values.yaml
|
||||
|
||||
# Optional: bump chart version and appVersion
|
||||
sed -i 's/^version: .*/version: ${newTag}/' Chart.yaml
|
||||
sed -i 's/^appVersion: .*/appVersion: ${newTag}/' Chart.yaml
|
||||
|
||||
git config user.name "jenkins"
|
||||
echo "[INFO] Packaging chart..."
|
||||
helm package .
|
||||
|
||||
echo "[INFO] Updating index.yaml..."
|
||||
helm repo index . --merge index.yaml || helm repo index .
|
||||
|
||||
echo "[INFO] Committing Helm chart changes..."
|
||||
git config user.name "Jenkins"
|
||||
git config user.email "jenkins@innohub.local"
|
||||
git add values.yaml Chart.yaml
|
||||
git commit -m "ci: update tatort-dev chart with image tag ${newTag}"
|
||||
git add values.yaml Chart.yaml *.tgz index.yaml
|
||||
git commit -m "ci: bump tatort chart to ${newTag}, package + index"
|
||||
git push origin main
|
||||
"""
|
||||
}
|
||||
@@ -116,7 +129,7 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
post {
|
||||
success {
|
||||
script {
|
||||
|
||||
Reference in New Issue
Block a user