blob: 13a74ed5815f1d79f0125a02f6758cbec9c1763a [file] [log] [blame]
---
# CORD helm chart publishing tasks
- project:
name: helm-repo
# add repos that have documentation to the project list in both jobs
jobs:
- 'publish-helm-repo':
project-regexp: '{helm-charts-projects-regexp}'
branch-regexp: '{supported-branches-regexp}'
- job-template:
id: publish-helm-repo
name: 'publish-helm-repo'
description: |
Created by publish-helm-repo job-template from ci-management/jjb/charts.yaml
triggers:
- cord-infra-gerrit-trigger-merge:
gerrit-server-name: '{gerrit-server-name}'
project-regexp: '{project-regexp}'
branch-regexp: '{branch-regexp}'
file-include-regexp: '{all-files-regexp}'
dependency-jobs: '{dependency-jobs}'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: '{build-timeout}'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- lf-infra-gerrit-scm:
git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: ''
branch: '$GERRIT_BRANCH'
submodule-disable: '{submodule-disable}'
submodule-recursive: 'false'
submodule-timeout: '{submodule-timeout}'
choosing-strategy: 'gerrit'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
node: 'ubuntu16.04-basebuild-2c-4g'
project-type: freestyle
concurrent: false
builders:
- shell: |
#!/usr/bin/env bash
set -eu -o pipefail
echo "git version: $(git --version)"
# Configure git
git config --global user.email "do-not-reply@opencord.org"
git config --global user.name "Jenkins"
# Checkout 'cord-charts-repo' repo that contains updated charts
git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git
# Clone the `helm-repo-tools` which contains scripts
git clone ssh://jenkins@gerrit.opencord.org:29418/helm-repo-tools.git
# Setup helm and external repos
helm init --client-only
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
helm repo add rook-release https://charts.rook.io/release
helm repo add cord https://charts.opencord.org
helm repo add elastic https://helm.elastic.co
helm repo add kiwigrid https://kiwigrid.github.io
# Update the repo
./helm-repo-tools/helmrepo.sh
# Tag and push to git the charts repo
pushd cord-charts-repo
# only update if charts are changed
set +e
if git diff --exit-code index.yaml > /dev/null; then
echo "No changes to charts in patchset $GERRIT_CHANGE_NUMBER on project: $GERRIT_PROJECT, exiting."
exit 0
fi
set -e
# version tag is the current date in RFC3339 format
NEW_VERSION=$(date -u +%Y%m%dT%H%M%SZ)
# Add changes and create commit
git add -A
git commit -m "Changed by CORD Jenkins publish-helm-repo job: $BUILD_NUMBER, for project: $GERRIT_PROJECT, patchset: $GERRIT_CHANGE_NUMBER"
# create tag on new commit
git tag "$NEW_VERSION"
echo "Tags including new tag:"
git tag -n
# push new commit and tag back into repo
git push origin
git push origin "$NEW_VERSION"
popd
# Set up the ssh host keys for the docs host
mkdir -p ~/.ssh
echo '{docs-ssh-host-key}' >> ~/.ssh/known_hosts
# Copy updated repo to host
rsync -rvzh --delete-after --exclude=.git cord-charts-repo/ {docs-ssh-host}:/var/www/charts
publishers:
- email:
recipients: 'andy@opennetworking.org kailash@opennetworking.org luca@opennetworking.org teo@opennetworking.org saurav@opennetworking.org zdw@opennetworking.org'
# check helm charts with `helm lint --strict` and that charts version is
# updated when the contents of a chart is modified.
- job-template:
id: verify-helm-lint
name: 'verify_{project}_helm-lint'
description: |
Created by verify-helm-lint job-template from ci-management/jjb/charts.yaml
triggers:
- cord-infra-gerrit-trigger-patchset:
gerrit-server-name: '{gerrit-server-name}'
project-regexp: '^{project}$'
branch-regexp: '{branch-regexp}'
file-include-regexp: '{all-files-regexp}'
dependency-jobs: '{dependency-jobs}'
properties:
- cord-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
wrappers:
- lf-infra-wrappers:
build-timeout: '{build-timeout}'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
scm:
- lf-infra-gerrit-scm:
git-url: '$GIT_URL/$GERRIT_PROJECT'
refspec: '$GERRIT_REFSPEC'
branch: '$GERRIT_BRANCH'
submodule-disable: '{submodule-disable}'
submodule-recursive: 'false'
submodule-timeout: '{submodule-timeout}'
choosing-strategy: gerrit
jenkins-ssh-credential: '{jenkins-ssh-credential}'
node: 'ubuntu16.04-basebuild-2c-4g'
project-type: freestyle
concurrent: true
builders:
- shell: |
#!/usr/bin/env bash
set -eu -o pipefail
# Setup helm and external repos
helm init --client-only
helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
helm repo add rook-release https://charts.rook.io/release
helm repo add cord https://charts.opencord.org
git clone https://gerrit.opencord.org/helm-repo-tools
./helm-repo-tools/helmlint.sh clean
# Specify the remote branch to compare against
export COMPARISON_BRANCH="origin/$GERRIT_BRANCH"
./helm-repo-tools/chart_version_check.sh
# Check for chart version conflicts by building the repo (don't upload)
git clone ssh://jenkins@gerrit.opencord.org:29418/cord-charts-repo.git
./helm-repo-tools/helmrepo.sh