CEC-2693 devops deploy to new production (#221)
* dev * bump * bump * bump * tweak * bump * staging * prod * deploy both? * cleanup * final * oops
This commit is contained in:
5
.env.cec-prd
Normal file
5
.env.cec-prd
Normal file
@@ -0,0 +1,5 @@
|
||||
REACT_APP_AUTH_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/compute_auth
|
||||
REACT_APP_CERT_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/certificate
|
||||
REACT_APP_UPLOAD_SERVICE_URL=https://gw.cec-prd.fiskerinc.com/ota_update
|
||||
REACT_APP_AUTH_CALLBACK_URL=https://ota-admin.cec-prd.fiskerinc.com
|
||||
REACT_APP_SUPERSET_URL=https://superset.cec-prd.fiskerinc.com/superset/dashboard/9/?native_filters_key=mfJ1VjGTcLUKz7gQs_DgClZhjcdNucYMrPruNibcyDnhkDwdHbAumBRVTpA5tFH_
|
||||
47
.github/workflows/deploy.yml
vendored
47
.github/workflows/deploy.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
- main
|
||||
- "release/**"
|
||||
- "hotfix/**"
|
||||
|
||||
env:
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
SLACK_CHANNEL: "#cloud-builds"
|
||||
@@ -19,13 +20,13 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
build-env: ${{ steps.set-env.outputs.build-env }}
|
||||
build-env: ${{ steps.set-env.outputs.ENVIRONMENT }}
|
||||
steps:
|
||||
- name: Slack Notification
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Azure Login
|
||||
uses: azure/login@v1
|
||||
@@ -55,13 +56,13 @@ jobs:
|
||||
ENVIRONMENT=dev;;
|
||||
esac
|
||||
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_ENV
|
||||
echo "::set-output name=build-env::${ENVIRONMENT}"
|
||||
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
build-args: ENVIRONMENT=${{ env.ENVIRONMENT }}
|
||||
@@ -70,12 +71,26 @@ jobs:
|
||||
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
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: [self-hosted, azure]
|
||||
env:
|
||||
ENVIRONMENT: ${{ needs.build.outputs.build-env }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
@@ -90,16 +105,32 @@ jobs:
|
||||
--set image.tag=$TAG-$ENVIRONMENT \
|
||||
--wait -i -f k8s/values-$ENVIRONMENT.yaml $PROJECT k8s/
|
||||
|
||||
- name: Notify if success
|
||||
if: ${{ success() }}
|
||||
- name: Notify deploy
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}! :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'
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
MSG_MINIMAL: true
|
||||
SLACK_MESSAGE: "Successfully deployed ${{ env.PROJECT }} to cec-${{ env.ENVIRONMENT }}! :gopher_party:"
|
||||
|
||||
- name: Notify if failure
|
||||
if: ${{ failure() }}
|
||||
uses: rtCamp/action-slack-notify@v2
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "Something failed! :this-is-fine:"
|
||||
SLACK_MESSAGE: "Failed to deploy ${{ env.PROJECT }} to ${{ env.ENVIRONMENT }}! :this-is-fine:"
|
||||
|
||||
12
k8s/values-cec-prd.yaml
Normal file
12
k8s/values-cec-prd.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
ingress:
|
||||
hostname: ota-admin.cec-prd.fiskerinc.com
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
|
||||
replicas: 3
|
||||
@@ -37,6 +37,7 @@
|
||||
"build:dev": "env-cmd -f .env.dev react-scripts build",
|
||||
"build:stg": "env-cmd -f .env.stg react-scripts build",
|
||||
"build:prd": "env-cmd -f .env.prd react-scripts build",
|
||||
"build:cec-prd": "env-cmd -f .env.cec-prd react-scripts build",
|
||||
"build:local": "env-cmd -f .env.local react-scripts build",
|
||||
"test": "env-cmd -f .env.local react-scripts test --no-cache",
|
||||
"test:debug": "react-scripts --inspect-brk test --runInBand --no-cache",
|
||||
|
||||
Reference in New Issue
Block a user