mirror of
https://github.com/bitnami/charts.git
synced 2026-03-06 06:58:50 +08:00
* Added antiflake pipeline Signed-off-by: alukic <alukic@vmware.com> * Diversified the pipeline Signed-off-by: alukic <alukic@vmware.com> * Make a change to trigger TKG Signed-off-by: alukic <alukic@vmware.com> * Replaced FIPS with normal AKS Signed-off-by: alukic <alukic@vmware.com> * Added extra workflow for Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Changed the pipeline Signed-off-by: alukic <alukic@vmware.com> * Modified the workflow Signed-off-by: alukic <alukic@vmware.com> * Removed Grafana Loki Signed-off-by: alukic <alukic@vmware.com> * Added Elasticsearch to publish pipeline Signed-off-by: alukic <alukic@vmware.com> * Removed antiflake Signed-off-by: alukic <alukic@vmware.com> * Corrected a typo Signed-off-by: alukic <alukic@vmware.com>
187 lines
7.8 KiB
YAML
187 lines
7.8 KiB
YAML
name: 'CD Pipeline'
|
|
on: # rebuild any PRs and main branch changes
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'bitnami/airflow/**'
|
|
- 'bitnami/consul/**'
|
|
- 'bitnami/discourse/**'
|
|
- 'bitnami/dokuwiki/**'
|
|
- 'bitnami/elasticsearch/**'
|
|
- 'bitnami/external-dns/**'
|
|
- 'bitnami/ghost/**'
|
|
- 'bitnami/grafana-loki/**'
|
|
- 'bitnami/grafana/**'
|
|
- 'bitnami/haproxy-intel/**'
|
|
- 'bitnami/harbor/**'
|
|
- 'bitnami/jenkins/**'
|
|
- 'bitnami/kafka/**'
|
|
- 'bitnami/keycloak/**'
|
|
- 'bitnami/kibana/**'
|
|
- 'bitnami/mariadb/**'
|
|
- 'bitnami/mediawiki/**'
|
|
- 'bitnami/minio/**'
|
|
- 'bitnami/mongodb/**'
|
|
- 'bitnami/mysql/**'
|
|
- 'bitnami/opencart/**'
|
|
- 'bitnami/owncloud/**'
|
|
- 'bitnami/phpmyadmin/**'
|
|
- 'bitnami/pinniped/**'
|
|
- 'bitnami/postgresql/**'
|
|
- 'bitnami/prestashop/**'
|
|
- 'bitnami/rabbitmq/**'
|
|
- 'bitnami/redis-cluster/**'
|
|
- 'bitnami/redis/**'
|
|
- 'bitnami/redmine/**'
|
|
- 'bitnami/sealed-secrets/**'
|
|
- 'bitnami/solr/**'
|
|
- 'bitnami/spring-cloud-dataflow/**'
|
|
- 'bitnami/suitecrm/**'
|
|
- 'bitnami/wordpress/**'
|
|
- '!**.md'
|
|
env:
|
|
CSP_API_URL: https://console.cloud.vmware.com
|
|
CSP_API_TOKEN: ${{ secrets.CSP_API_TOKEN }}
|
|
VIB_PUBLIC_URL: https://cp.bromelia.vmware.com
|
|
jobs:
|
|
get-chart:
|
|
runs-on: ubuntu-latest
|
|
name: 'Get modified charts'
|
|
outputs:
|
|
chart: ${{ steps.get-chart.outputs.chart }}
|
|
result: ${{ steps.get-chart.outputs.result }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: charts
|
|
fetch-depth: 2 # to be able to obtain files changed in the latest commit
|
|
- id: get-chart
|
|
name: 'Get modified charts'
|
|
run: |
|
|
cd charts
|
|
files_changed="$(git show --pretty="" --name-only)"
|
|
# Adding || true to avoid "Process exited with code 1" errors
|
|
charts_dirs_changed="$(echo "$files_changed" | xargs dirname | grep -o "bitnami/[^/]*" | sort | uniq || true)"
|
|
# Using grep -c as a better alternative to wc -l when dealing with empty strings."
|
|
num_charts_changed="$(echo "$charts_dirs_changed" | grep -c "bitnami" || true)"
|
|
num_version_bumps="$(echo "$files_changed" | grep Chart.yaml | xargs git show | grep -c "+version" || true)"
|
|
|
|
if [[ "$num_charts_changed" -ne "$num_version_bumps" ]]; then
|
|
# Changes done in charts but version not bumped -> ERROR
|
|
echo "::set-output name=error::Detected changes in charts without version bump in Chart.yaml.\nCharts changed: ${num_charts_changed}\n${charts_dirs_changed}\nVersion bumps detected: ${num_version_bumps}"
|
|
echo "::set-output name=result::fail"
|
|
elif [[ "$num_charts_changed" -eq "1" ]]; then
|
|
# Changes done in only one chart -> OK
|
|
chart_name=$(echo "$charts_dirs_changed" | sed "s|bitnami/||g")
|
|
echo "::set-output name=chart::${chart_name}"
|
|
echo "::set-output name=result::ok"
|
|
else
|
|
# Changes done in more than chart -> FAIL
|
|
echo -e "::set-output name=error::Changes detected in more than one chart directory:\n${charts_dirs_changed}\nThe publish process will be stopped. Please create different commits for each chart."
|
|
echo "::set-output name=result::fail"
|
|
fi
|
|
- id: show-error
|
|
name: 'Show error'
|
|
if: ${{ steps.get-chart.outputs.result == 'fail' }}
|
|
uses: actions/github-script@v3
|
|
with:
|
|
script: |
|
|
core.setFailed('${{ steps.get-chart.outputs.error }}')
|
|
|
|
vib-publish:
|
|
runs-on: ubuntu-latest
|
|
needs: get-chart
|
|
if: ${{ needs.get-chart.outputs.result == 'ok' }}
|
|
name: VIB Publish
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
name: Checkout Repository
|
|
with:
|
|
path: charts
|
|
- uses: vmware-labs/vmware-image-builder-action@main
|
|
name: Verify and publish ${{ needs.get-chart.outputs.chart }}
|
|
with:
|
|
pipeline: ${{ needs.get-chart.outputs.chart }}/vib-publish.json
|
|
config: charts/.vib/
|
|
env:
|
|
VIB_ENV_TARGET_PLATFORM: 7ddab896-2e4e-4d58-a501-f79897eba3a0
|
|
VIB_ENV_ALTERNATIVE_TARGET_PLATFORM: 91d398a2-25c4-4cda-8732-75a3cfc179a1
|
|
VIB_ENV_S3_URL: s3://${{ secrets.AWS_S3_BUCKET }}/bitnami
|
|
VIB_ENV_S3_USERNAME: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
VIB_ENV_S3_PASSWORD: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
# If we perform a checkout of the master branch, we will find conflicts with the submodules
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: 'index'
|
|
path: index
|
|
token: ${{ secrets.BITNAMI_BOT_TOKEN }}
|
|
- name: Install and configure aws-cli, helm and yq
|
|
run: |
|
|
# AWS CLI
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y awscli
|
|
aws configure set region us-east-1
|
|
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
aws configure set source_profile default
|
|
# helm
|
|
HELM_TARBALL="helm-v3.8.1-linux-amd64.tar.gz"
|
|
curl -SsLfO "https://get.helm.sh/${HELM_TARBALL}" && sudo tar xf "$HELM_TARBALL" --strip-components 1 -C /usr/local/bin
|
|
# yq
|
|
sudo curl -SsLf https://github.com/mikefarah/yq/releases/download/v4.23.1/yq_linux_amd64 -o /usr/local/bin/yq && sudo chmod +x /usr/local/bin/yq
|
|
- name: Fetch chart and update index
|
|
run: |
|
|
mkdir download
|
|
chart="${{ needs.get-chart.outputs.chart }}"
|
|
# HACK: Obtain chart tarball out of the latest commit
|
|
chart_version="$(yq ".version" charts/bitnami/${chart}/Chart.yaml)"
|
|
aws s3 cp s3://${{ secrets.AWS_S3_BUCKET }}/bitnami/${chart}-${chart_version}.tgz download/
|
|
# Rebuild index
|
|
helm repo index --url https://charts.bitnami.com/bitnami --merge index/bitnami/index.yaml download
|
|
cp download/index.yaml index/bitnami/index.yaml
|
|
cd index
|
|
# Push changes
|
|
git config user.name "Bitnami Containers"
|
|
git config user.email "bitnami-bot@vmware.com"
|
|
git add bitnami/index.yaml && git commit -m "${chart}-${chart_version}: Update index.yaml" -s && git push
|
|
|
|
# If the CD Pipeline does not succeed we should notify the interested agents
|
|
slack-notif:
|
|
runs-on: ubuntu-latest
|
|
needs: vib-publish
|
|
if: always()
|
|
name: Notify unsuccessful CD run
|
|
steps:
|
|
- name: Notify in Slack channel
|
|
if: ${{ needs.vib-publish.result != 'success' }}
|
|
uses: slackapi/slack-github-action@v1.19.0
|
|
with:
|
|
channel-id: ${{ secrets.CD_SLACK_CHANNEL_ID }}
|
|
payload: |
|
|
{
|
|
"attachments": [
|
|
{
|
|
"color": "#CC0000",
|
|
"fallback": "Unsuccessful bitnami/charts CD pipeline",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "*Unsuccessful `bitnami/charts` CD pipeline*"
|
|
}
|
|
},
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": "The CD pipeline for <${{ github.event.head_commit.url }}|bitnami/charts@${{ github.event.head_commit.id }}> did not succeed. Check the related <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|action run> for more information."
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
env:
|
|
SLACK_BOT_TOKEN: ${{ secrets.CD_SLACK_BOT_TOKEN }}
|