Merge branch 'main' into CEC-5900

This commit is contained in:
Paul Adamsen
2024-04-08 11:01:42 -04:00
committed by GitHub
4 changed files with 212 additions and 125 deletions

View File

@@ -9,6 +9,9 @@ on:
type: choice type: choice
options: options:
- dev - dev
- preprod
- cec-prd
- cec-euprd
env: env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
@@ -21,11 +24,13 @@ env:
PROJECT: ota-admin-portal-v2 PROJECT: ota-admin-portal-v2
REGISTRY: fiskercloud.azurecr.io REGISTRY: fiskercloud.azurecr.io
permissions:
id-token: write
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
build-env: ${{ steps.set-env.outputs.ENVIRONMENT }}
steps: steps:
- name: Slack Notification - name: Slack Notification
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -34,7 +39,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -48,22 +53,6 @@ jobs:
- name: JFrog Auth - name: JFrog Auth
run: echo ${JFROG_NPMRC} | base64 -d > .npmrc run: echo ${JFROG_NPMRC} | base64 -d > .npmrc
- name: Set Env
env:
ENV: ${{ inputs.environment }}
id: set-env
run: |
case ${ENV} in
dev)
ENVIRONMENT=dev;;
preprod)
ENVIRONMENT=prd;;
*)
ENVIRONMENT=dev;;
esac
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -71,7 +60,7 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
build-args: ENVIRONMENT=${{ env.ENVIRONMENT }} build-args: ENVIRONMENT=${{ inputs.environment }}
push: true push: true
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }} tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}
cache-from: type=gha cache-from: type=gha
@@ -82,30 +71,56 @@ jobs:
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
env: env:
SLACK_COLOR: ${{ job.status }} SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} ${{ inputs.environment }}! :this-is-fine:" SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} in ${{ inputs.environment }}! :this-is-fine:"
deploy: deploy:
needs: build needs: build
runs-on: [self-hosted, azure] runs-on: arc-azure-${{ inputs.environment }}
env:
ENVIRONMENT: ${{ needs.build.outputs.build-env }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2 - name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ inputs.environment }}... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ inputs.environment }}... :partydeploy:"
- name: Deploy - name: Set env
run: |- run: |
helm upgrade \ case ${{ inputs.environment }} in
--kube-context $ENVIRONMENT \ dev)
--set image.registry=$REGISTRY \ KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_DEV }};;
--set image.name=$PROJECT \ preprod)
--set image.tag=$TAG \ KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_PREPROD }};;
--wait -i -f k8s/values-$ENVIRONMENT.yaml $PROJECT k8s/ cec-prd)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_CEC_PRD }};;
cec-euprd)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_CEC_EUPRD }};;
*)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_DEV }};;
esac
echo "KUBECONFIG=${KUBECONFIG}" >> $GITHUB_ENV
- name: Deploy to env
id: deploy
uses: koslib/helm-eks-action@v1.28.0
env:
KUBE_CONFIG_DATA: ${{ env.KUBECONFIG }}
with:
command: |
helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG \
--wait -i -f k8s/values-${{ inputs.environment }}.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure - name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}

View File

@@ -10,6 +10,8 @@ on:
options: options:
- dev - dev
- preprod - preprod
- cec-prd
- cec-euprd
env: env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
@@ -21,11 +23,13 @@ env:
PROJECT: ota-admin-portal PROJECT: ota-admin-portal
REGISTRY: fiskercloud.azurecr.io REGISTRY: fiskercloud.azurecr.io
permissions:
id-token: write
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
build-env: ${{ steps.set-env.outputs.ENVIRONMENT }}
steps: steps:
- name: Slack Notification - name: Slack Notification
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -34,7 +38,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -45,21 +49,6 @@ jobs:
username: ${{ secrets.AZURE_CLIENT_ID }} username: ${{ secrets.AZURE_CLIENT_ID }}
password: ${{ secrets.AZURE_CLIENT_SECRET }} password: ${{ secrets.AZURE_CLIENT_SECRET }}
- name: Set Env
env:
ENV: ${{ inputs.environment }}
id: set-env
run: |
case ${ENV} in
dev)
ENVIRONMENT=dev;;
preprod)
ENVIRONMENT=prd;;
*)
ENVIRONMENT=dev;;
esac
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -68,44 +57,77 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
build-args: ENVIRONMENT=${{ env.ENVIRONMENT }} build-args: ENVIRONMENT=${{ inputs.environment }}
push: true push: true
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-${{ env.ENVIRONMENT }} tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-${{ inputs.environment }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
deploy:
needs: build
runs-on: [self-hosted, azure]
env:
ENVIRONMENT: ${{ needs.build.outputs.build-env }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ inputs.environment }}... :partydeploy:"
- name: Deploy
run: |-
helm upgrade \
--kube-context $ENVIRONMENT \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-$ENVIRONMENT \
--wait -i -f k8s/values-$ENVIRONMENT.yaml $PROJECT k8s/
- name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: true
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to ${{ inputs.environment }}! :gopher_party:"
- name: Notify if failure - name: Notify if failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} in ${{ inputs.environment }}! :this-is-fine:"
deploy:
needs: build
runs-on: arc-azure-${{ inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ inputs.environment }}... :partydeploy:"
- name: Set env
run: |
case ${{ inputs.environment }} in
dev)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_DEV }};;
preprod)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_PREPROD }};;
cec-prd)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_CEC_PRD }};;
cec-euprd)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_CEC_EUPRD }};;
*)
KUBECONFIG=${{ secrets.KUBECONFIG_AZURE_DEV }};;
esac
echo "KUBECONFIG=${KUBECONFIG}" >> $GITHUB_ENV
- name: Deploy to env
id: deploy
uses: koslib/helm-eks-action@v1.28.0
env:
KUBE_CONFIG_DATA: ${{ env.KUBECONFIG }}
with:
command: |
helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-${{ inputs.environment }} \
--wait -i -f k8s/values-${{ inputs.environment }}.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
env: env:
SLACK_COLOR: ${{ job.status }} SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} to ${{ inputs.environment }}! :this-is-fine:" SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} to ${{ inputs.environment }}! :this-is-fine:"
- name: Notify deploy success
uses: rtCamp/action-slack-notify@v2
env:
MSG_MINIMAL: true
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to ${{ inputs.environment }}! :gopher_party:"

View File

@@ -15,6 +15,10 @@ env:
PROJECT: ota-admin-portal PROJECT: ota-admin-portal
REGISTRY: fiskercloud.azurecr.io REGISTRY: fiskercloud.azurecr.io
permissions:
id-token: write
contents: read
jobs: jobs:
build-dev: build-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -27,7 +31,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -60,26 +64,37 @@ jobs:
deploy-dev: deploy-dev:
needs: [build-dev] needs: [build-dev]
runs-on: [self-hosted, azure] runs-on: [ arc-azure-dev ]
environment: dev environment: dev
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2 - name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to dev... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to dev... :partydeploy:"
- name: Deploy to dev - name: Deploy to dev
run: |- id: deploy
helm upgrade \ uses: koslib/helm-eks-action@v1.28.0
--kube-context dev \ env:
--set image.registry=$REGISTRY \ KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_DEV }}
--set image.name=$PROJECT \ with:
--set image.tag=$TAG-dev \ command: |
--wait -i -f k8s/values-dev.yaml $PROJECT k8s/ helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-dev \
--wait -i -f k8s/values-dev.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure - name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -104,7 +119,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -137,26 +152,38 @@ jobs:
deploy-preprod: deploy-preprod:
needs: [deploy-dev, build-preprod] needs: [deploy-dev, build-preprod]
runs-on: [self-hosted, azure] runs-on: [ arc-azure-preprod ]
environment: stg environment: preprod
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2 - name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to preprod... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to preprod... :partydeploy:"
- name: Deploy to preprod - name: Deploy to preprod
run: |- id: deploy
helm upgrade \ uses: koslib/helm-eks-action@v1.28.0
--kube-context prd \ env:
--set image.registry=$REGISTRY \ KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_PREPROD }}
--set image.name=$PROJECT \ with:
--set image.tag=$TAG-prd \ command: |
--wait -i -f k8s/values-prd.yaml $PROJECT k8s/ helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-prd \
--wait -i -f k8s/values-prd.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure - name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -181,7 +208,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -214,26 +241,38 @@ jobs:
deploy-cec-prd: deploy-cec-prd:
needs: [deploy-dev, deploy-preprod, build-cec-prd] needs: [deploy-dev, deploy-preprod, build-cec-prd]
runs-on: [self-hosted, azure] runs-on: [ arc-azure-cec-prd ]
environment: prd environment: prd
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2 - name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-prd... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-prd... :partydeploy:"
- name: Deploy to cec-prd - name: Deploy to cec-prd
run: |- id: deploy
helm upgrade \ uses: koslib/helm-eks-action@v1.28.0
--kube-context cec-prd-cluster-1 \ env:
--set image.registry=$REGISTRY \ KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_CEC_PRD }}
--set image.name=$PROJECT \ with:
--set image.tag=$TAG-cec-prd \ command: |
--wait -i -f k8s/values-cec-prd.yaml $PROJECT k8s/ helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-cec-prd \
--wait -i -f k8s/values-cec-prd.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure - name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2
@@ -258,7 +297,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Azure Login - name: Azure Login
uses: azure/login@v1 uses: azure/login@v2
with: with:
creds: ${{ secrets.AZURE_CREDENTIALS }} creds: ${{ secrets.AZURE_CREDENTIALS }}
@@ -291,26 +330,37 @@ jobs:
deploy-cec-euprd: deploy-cec-euprd:
needs: [deploy-dev, deploy-preprod, build-cec-euprd] needs: [deploy-dev, deploy-preprod, build-cec-euprd]
runs-on: [self-hosted, azure] runs-on: [ arc-azure-cec-euprd ]
environment: prd environment: prd
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: rtCamp/action-slack-notify@v2 - name: Notify deploy
uses: rtCamp/action-slack-notify@v2
env: env:
MSG_MINIMAL: true MSG_MINIMAL: true
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-euprd... :partydeploy:" SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-euprd... :partydeploy:"
- name: Deploy to cec-euprd - name: Deploy to cec-euprd
run: |- id: deploy
helm upgrade \ uses: koslib/helm-eks-action@v1.28.0
--kube-context cec-euprd-cluster-1 \ env:
--set image.registry=$REGISTRY \ KUBE_CONFIG_DATA: ${{ secrets.KUBECONFIG_AZURE_CEC_EUPRD }}
--set image.name=$PROJECT \ with:
--set image.tag=$TAG-cec-euprd \ command: |
--wait -i -f k8s/values-cec-euprd.yaml $PROJECT k8s/ helm upgrade \
--atomic \
--create-namespace \
--namespace default \
--set image.registry=$REGISTRY \
--set image.name=$PROJECT \
--set image.tag=$TAG-cec-euprd \
--wait -i -f k8s/values-cec-euprd.yaml $PROJECT k8s/
- name: Deploy Response
run: echo "Response was ${{ steps.deploy.outputs.response }}"
- name: Notify deploy failure - name: Notify deploy failure
if: ${{ failure() }} if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2 uses: rtCamp/action-slack-notify@v2

View File

@@ -9,4 +9,4 @@ on:
jobs: jobs:
prcheck: prcheck:
uses: Fisker-Inc/github-actions/.github/workflows/pr.yml@main uses: Fisker-Inc/github-actions/.github/workflows/pr.yml@v1.0.16