Allow databases with same name in same namespace (#531) #1418
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GOOGLE_REGISTRY: "europe-north1-docker.pkg.dev" | |
FEATURE_NAME: "naiserator" | |
on: | |
push: | |
paths-ignore: | |
- "*.md" | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 # ratchet:exclude | |
- uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # ratchet:azure/setup-helm@v3 | |
with: | |
version: "v3.11.1" | |
- uses: nais/build-push-sign@main | |
id: build_push_sign | |
with: | |
name: naiserator | |
dockerfile: Dockerfile | |
google_service_account: gh-naiserator | |
push: ${{ github.actor != 'dependabot[bot]' }} | |
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }} | |
- name: Package chart | |
id: package_chart | |
env: | |
CHART_PATH: ./charts/${{ env.FEATURE_NAME }} | |
run: | | |
base_version="$(yq '.version' < "${{ env.CHART_PATH }}/Chart.yaml")" | |
chart_version="${base_version}-${{ steps.build_push_sign.outputs.version }}" | |
yq eval \ | |
'.version="'"$chart_version"'"' \ | |
"${{ env.CHART_PATH }}/Chart.yaml" --inplace | |
yq eval \ | |
'.imageTag="${{ steps.build_push_sign.outputs.version }}"' \ | |
"${{ env.CHART_PATH }}/values.yaml" --inplace | |
# helm dependency update "${{ env.CHART_PATH }}" | |
helm package "${{ env.CHART_PATH }}" --destination . | |
name=$(yq '.name' < "${{ env.CHART_PATH }}/Chart.yaml") | |
echo "name=$name" >> $GITHUB_OUTPUT | |
echo "version=$chart_version" >> $GITHUB_OUTPUT | |
echo "archive=$name-$chart_version.tgz" >> $GITHUB_OUTPUT | |
- id: "auth" | |
if: github.ref == 'refs/heads/master' | |
name: "Authenticate to Google Cloud" | |
uses: "google-github-actions/auth@v2" # ratchet:exclude | |
with: | |
workload_identity_provider: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: "gh-${{ env.FEATURE_NAME }}@nais-io.iam.gserviceaccount.com" | |
token_format: "access_token" | |
- name: "Log in to Google Artifact Registry" | |
if: github.ref == 'refs/heads/master' | |
run: |- | |
echo '${{ steps.auth.outputs.access_token }}' | docker login -u oauth2accesstoken --password-stdin https://${{ env.GOOGLE_REGISTRY }} | |
- name: Push Chart | |
if: github.ref == 'refs/heads/master' | |
run: |- | |
chart="${{ steps.package_chart.outputs.archive }}" | |
echo "Pushing: $chart" | |
helm push "$chart" oci://${{ env.GOOGLE_REGISTRY }}/nais-io/nais/feature | |
outputs: | |
chart_name: ${{ steps.package_chart.outputs.name }} | |
chart_version: ${{ steps.package_chart.outputs.version }} | |
chart_archive: ${{ steps.package_chart.outputs.archive }} | |
rollout: | |
runs-on: fasit-deploy | |
permissions: | |
id-token: write | |
needs: | |
- build_and_push | |
steps: | |
- uses: nais/fasit-deploy@v2 # ratchet:exclude | |
if: github.ref == 'refs/heads/master' | |
with: | |
chart: oci://${{ env.GOOGLE_REGISTRY }}/nais-io/nais/feature/${{ needs.build_and_push.outputs.chart_name }} | |
version: ${{ needs.build_and_push.outputs.chart_version }} |