Skip to content

build-and-push-dependent-helm-chart #57

build-and-push-dependent-helm-chart

build-and-push-dependent-helm-chart #57

name: build-and-push-dependent-helm-chart
on:
workflow_dispatch:
inputs:
dependentHelmChartName:
description: 'Dependent HELM chart name. This must be `kube-state-metrics` or `prometheus-node-exporter`'
required: true
jobs:
build-and-push-dependent-HELM-chart:
runs-on: ubuntu-latest
steps:
- name: Set-workflow-initiator
run: echo "Initiated by - ${GITHUB_ACTOR}"
- name: Show-versions-On-deployment-machine
run: lsb_release -a && helm version
- name: Set-Helm-OCI-Experimental-feature
run: echo "HELM_EXPERIMENTAL_OCI=1" >> $GITHUB_ENV
- name: Set-ACR-Registry
run: echo "ACR_REGISTRY=containerinsightsprod.azurecr.io" >> $GITHUB_ENV
- name: Set-ACR-Repository-HELM-Chart
run: echo "ACR_REPOSITORY_HELM=/public/azuremonitor/containerinsights/cidev" >> $GITHUB_ENV
- name: Set-MCR-HELM-CHART-Repository-Root
run: echo "MCR_REPOSITORY_ROOT=mcr.microsoft.com/azuremonitor/containerinsights/cidev/" >> $GITHUB_ENV
- name: Checkout-code
uses: actions/checkout@v4
- name: Lint-HELM-Chart
run: helm lint ./otelcollector/deploy/dependentcharts/${{ github.event.inputs.dependentHelmChartName }}/
- name: Run-trivy-scanner-on-HELM-chart-fs
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
scan-ref: "./otelcollector/deploy/dependentcharts/${{ github.event.inputs.dependentHelmChartName }}/"
format: 'table'
severity: 'CRITICAL,HIGH,MEDIUM'
exit-code: '1'
timeout: '5m0s'
- name: Package-HELM-chart
run: cd ./otelcollector/deploy/dependentcharts/ && rm -f ./${{ github.event.inputs.dependentHelmChartName }}/*.md && helm package ./${{ github.event.inputs.dependentHelmChartName }}/
- name: Login-to-ACR-thru-Helm
run: echo ${{ secrets.MANAGED_PROM_SERVICE_PRINCIPAL_PASSWORD }} | helm registry login --username ${{ secrets.MANAGED_PROM_SERVICE_PRINCIPAL_OBJECT_ID }} --password-stdin containerinsightsprod.azurecr.io
- name: Publish-Helm-chart-to-ACR
run: cd ./otelcollector/deploy/dependentcharts/ && helm push ${{ github.event.inputs.dependentHelmChartName }}-*.tgz oci://${{ env.ACR_REGISTRY }}${{ env.ACR_REPOSITORY_HELM }}