43 lines
1.5 KiB
YAML
43 lines
1.5 KiB
YAML
---
|
|
stages:
|
|
- test
|
|
- deploy
|
|
|
|
lint:charts:
|
|
image:
|
|
name: alpine/helm
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
stage: test
|
|
script:
|
|
- helm lint charts/*
|
|
|
|
pages:
|
|
image:
|
|
name: alpine/helm
|
|
entrypoint: ["/bin/sh", "-c"]
|
|
stage: deploy
|
|
before_script:
|
|
- grep 'repository:' charts/*/Chart.yaml | awk '{ print $3 }' | uniq | xargs -rn1 sh -c 'helm repo add $(basename $0) $0'
|
|
- helm repo update
|
|
- ls -d1 charts/* | xargs -rn1 helm dependency build --skip-refresh
|
|
script:
|
|
- mkdir -p packaged
|
|
- (cd packaged; helm package ../charts/*)
|
|
- ls -d1 packaged/* | xargs -rn1 sh -c '
|
|
curl --user gitlab-ci-token:$CI_JOB_TOKEN "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable/charts/$(basename $0)" -Iso /dev/null -w "%{http_code}" | grep 200 ||
|
|
curl --request POST --user gitlab-ci-token:$CI_JOB_TOKEN --form "chart=@$0" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/api/${CHANNEL}/charts"
|
|
'
|
|
- echo "Allowing some time for changes to percolate..."
|
|
- sleep 10
|
|
- mkdir -p public
|
|
- "echo \"User-Agent: *\nDisallow: /\" > ./public/robots.txt"
|
|
- curl --user gitlab-ci-token:$CI_JOB_TOKEN "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/${CHANNEL}/index.yaml" -o repo-index.yaml
|
|
- sed -e "s|- charts/|- ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/${CHANNEL}/charts/|" repo-index.yaml > ./public/index.yaml
|
|
- cp artifacthub-repo.yml ./public/
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
variables:
|
|
CHANNEL: stable
|
|
only:
|
|
- master@ananace/charts
|