CEC-4854 Trunk-based deploy pipeline (#412)
* CEC-4855: fix manifest deselect (#410) * fix manifest deselect * adjusted blackduck pipeline to run the latest detect version * added blackduck_rapid pipeline to run synopsys detect rapid scans * adjusted deploy pipeline to trun-based model, adjusted test pipeline to use main branch * test image builds * clean up * CEC-4563: add cancel and include results in promise (#411) * splited build and deploy order according to each environment, test builds * clean up * clean up * CEC-4635: prevent false 0 calculation (#413) * prevent false 0 calculation * refactor switch statement --------- Co-authored-by: Tristan Timblin <ttimblin@fiskerinc.com>
This commit is contained in:
424
.github/workflows/deploy.yml
vendored
424
.github/workflows/deploy.yml
vendored
@@ -3,10 +3,7 @@ name: OTA Portal Deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- "release/**"
|
||||
- "hotfix/**"
|
||||
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
@@ -19,10 +16,9 @@ env:
|
||||
REGISTRY: fiskercloud.azurecr.io
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-dev:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
build-env: ${{ steps.set-env.outputs.ENVIRONMENT }}
|
||||
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
@@ -42,64 +38,30 @@ jobs:
|
||||
username: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
password: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
|
||||
- name: Set Env
|
||||
id: set-env
|
||||
run: |
|
||||
case ${GITHUB_REF} in
|
||||
refs/heads/develop)
|
||||
ENVIRONMENT=dev;;
|
||||
refs/heads/release/*)
|
||||
ENVIRONMENT=stg;;
|
||||
refs/heads/hotfix/*)
|
||||
ENVIRONMENT=stg;;
|
||||
refs/heads/main)
|
||||
ENVIRONMENT=prd;;
|
||||
*)
|
||||
ENVIRONMENT=dev;;
|
||||
esac
|
||||
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
|
||||
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
- name: Build and push DEV
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=${{ env.ENVIRONMENT }}
|
||||
build-args: ENVIRONMENT=dev
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-${{ env.ENVIRONMENT }}
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-dev
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build and push new prod
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=cec-${{ env.ENVIRONMENT }}
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-${{ env.ENVIRONMENT }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build and push Germany
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=cec-eu${{ env.ENVIRONMENT }}
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-eu${{ env.ENVIRONMENT }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} dev! :this-is-fine:"
|
||||
|
||||
deploy-dev:
|
||||
needs: [build-dev]
|
||||
runs-on: [self-hosted, azure]
|
||||
env:
|
||||
ENVIRONMENT: ${{ needs.build.outputs.build-env }}
|
||||
environment: dev
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -107,60 +69,336 @@ jobs:
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}... :partydeploy:"
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to dev... :partydeploy:"
|
||||
|
||||
- name: Deploy
|
||||
- name: Deploy to dev
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context $ENVIRONMENT \
|
||||
--kube-context dev \
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-$ENVIRONMENT \
|
||||
--wait -i -f k8s/values-$ENVIRONMENT.yaml $PROJECT k8s/
|
||||
--set image.tag=$TAG-dev \
|
||||
--wait -i -f k8s/values-dev.yaml $PROJECT k8s/
|
||||
|
||||
- name: Notify deploy
|
||||
- name: Notify deploy failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on dev! :this-is-fine:"
|
||||
|
||||
- name: Notify deploy success
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}! :gopher_party:"
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to dev! :gopher_party:"
|
||||
|
||||
- name: Deploy new prod
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context cec-$ENVIRONMENT-cluster-1 \
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-cec-$ENVIRONMENT \
|
||||
--wait -i -f k8s/values-cec-$ENVIRONMENT.yaml $PROJECT k8s/
|
||||
|
||||
- name: Notify deploy new
|
||||
if: github.ref == 'refs/heads/main'
|
||||
build-stg:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev, deploy-dev]
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-${{ env.ENVIRONMENT }}! :gopher_party:"
|
||||
|
||||
- name: Deploy Germany
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context cec-eu$ENVIRONMENT-cluster-1 \
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-cec-eu$ENVIRONMENT \
|
||||
--wait -i -f k8s/values-cec-eu$ENVIRONMENT.yaml $PROJECT k8s/
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Notify deploy Germany
|
||||
if: github.ref == 'refs/heads/main'
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-eu${{ env.ENVIRONMENT }}! :gopher_party:"
|
||||
- name: Azure Login
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Login to ACR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
password: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push STG
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=stg
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-stg
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}! :this-is-fine:"
|
||||
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} stg! :this-is-fine:"
|
||||
|
||||
|
||||
deploy-stg:
|
||||
needs: [build-dev, deploy-dev, build-stg]
|
||||
runs-on: [self-hosted, azure]
|
||||
environment: stg
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to stg... :partydeploy:"
|
||||
|
||||
- name: Deploy to stg
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context stg \
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-stg \
|
||||
--wait -i -f k8s/values-stg.yaml $PROJECT k8s/
|
||||
|
||||
- name: Notify deploy failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on stg! :this-is-fine:"
|
||||
|
||||
- name: Notify deploy success
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to stg! :gopher_party:"
|
||||
|
||||
build-preprod:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev, deploy-dev]
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Login to ACR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
password: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push PREPROD
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=prd
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-prd
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} preprod! :this-is-fine:"
|
||||
|
||||
deploy-preprod:
|
||||
needs: [build-dev, deploy-dev, build-preprod]
|
||||
runs-on: [self-hosted, azure]
|
||||
environment: stg
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to preprod... :partydeploy:"
|
||||
|
||||
- name: Deploy to preprod
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context prd \
|
||||
--set image.registry=$REGISTRY \
|
||||
--set image.name=$PROJECT \
|
||||
--set image.tag=$TAG-prd \
|
||||
--wait -i -f k8s/values-prd.yaml $PROJECT k8s/
|
||||
|
||||
- name: Notify deploy failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on preprod! :this-is-fine:"
|
||||
|
||||
- name: Notify deploy success
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to preprod! :gopher_party:"
|
||||
|
||||
build-cec-prd:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev, deploy-dev, build-stg, deploy-stg, build-preprod, deploy-preprod]
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Login to ACR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
password: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push CEC-PRD
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=cec-prd
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-prd
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} cec-prd! :this-is-fine:"
|
||||
|
||||
deploy-cec-prd:
|
||||
needs: [build-dev, deploy-dev, build-stg, deploy-stg, build-preprod, deploy-preprod, build-cec-prd]
|
||||
runs-on: [self-hosted, azure]
|
||||
environment: prd
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-prd... :partydeploy:"
|
||||
|
||||
- name: Deploy to cec-prd
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context cec-prd-cluster-1 \
|
||||
--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: Notify deploy failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on cec-prd! :this-is-fine:"
|
||||
|
||||
- name: Notify deploy success
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-prd! :gopher_party:"
|
||||
|
||||
build-cec-euprd:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-dev, deploy-dev, build-stg, deploy-stg, build-preprod, deploy-preprod]
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
|
||||
- name: Login to ACR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
password: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push CEC-EUPRD
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=cec-euprd
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.PROJECT }}:${{ env.TAG }}-cec-euprd
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to build ${{ env.PROJECT }} cec-euprd! :this-is-fine:"
|
||||
|
||||
|
||||
deploy-cec-euprd:
|
||||
needs: [build-dev, deploy-dev, build-stg, deploy-stg, build-preprod, deploy-preprod, build-cec-euprd]
|
||||
runs-on: [self-hosted, azure]
|
||||
environment: prd
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Deploying ${{ env.PROJECT }} to cec-euprd... :partydeploy:"
|
||||
|
||||
- name: Deploy to cec-euprd
|
||||
run: |-
|
||||
helm upgrade \
|
||||
--kube-context cec-euprd-cluster-1 \
|
||||
--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: Notify deploy failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} on cec-euprd! :this-is-fine:"
|
||||
|
||||
- name: Notify deploy success
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-euprd! :gopher_party:"
|
||||
Reference in New Issue
Block a user