@@ -30,45 +30,38 @@ jobs:
3030 tags : pennlabs/penn-basics:latest,pennlabs/penn-basics:${{ github.sha }}
3131 deploy :
3232 runs-on : ubuntu-latest
33- container :
34- image : pennlabs/helm-tools:39b60af248944898fcbc58d1fe5b0f1995420aef
3533 if : github.ref == 'refs/heads/master'
3634 steps :
3735 - uses : actions/checkout@v2
38- - name : Deploy
36+ - id : synth
37+ name : Synth cdk8s manifests
3938 run : |-
40- aws eks --region us-east-1 update-kubeconfig --name production --role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/kubectl
39+ cd k8s
40+ yarn install --frozen-lockfile
4141
4242 # get repo name (by removing owner/organization)
4343 RELEASE_NAME=${REPOSITORY#*/}
4444
45- # this specifies what tag of icarus to pull down
46- DEPLOY_TAG=$(yq r k8s/values.yaml deploy_version)
47- if [ "$DEPLOY_TAG" = "null" ]; then
48- echo "Could not find deploy tag"
49- exit 1
50- fi
45+ # Export RELEASE_NAME as an output
46+ echo "::set-output RELEASE_NAME=$RELEASE_NAME"
47+
48+ yarn build
49+ env :
50+ GIT_SHA : ${{ github.sha }}
51+ REPOSITORY : ${{ github.repository }}
52+ AWS_ACCOUNT_ID : ${{ secrets.AWS_ACCOUNT_ID }}
53+ - name : Deploy
54+ run : |-
55+ aws eks --region us-east-1 update-kubeconfig --name production --role-arn arn:aws:iam::${AWS_ACCOUNT_ID}:role/kubectl
5156
52- helm repo add pennlabs https://helm.pennlabs.org/
53- for i in {1..10}; do
54- # This is bash soup, but it'll do.
55- # 1. Attempt to install with helm
56- # 2. If this succeeds, exit with a success status code
57- # 3. If it fails, mark the command as succeeded so that '-e' doesn't kick us out
58- # 4. Wait 10s and try again
59- helm upgrade --install --atomic --set=image_tag=$IMAGE_TAG -f k8s/values.yaml --version "${DEPLOY_TAG}" $RELEASE_NAME pennlabs/icarus && exit 0 || true
60- sleep 10s
61- echo "Retrying deploy for $i times"
62- done
57+ # get repo name from synth step
58+ RELEASE_NAME=${{ steps.synth.outputs.RELEASE_NAME }}
6359
64- # If we get here, all helm installs failed so our command should fail
65- exit 1
60+ # Deploy
61+ kubectl apply -f k8s/dist/ -l app.kubernetes.io/component=certificate
62+ kubectl apply -f k8s/dist/ --prune -l app.kubernetes.io/part-of=$RELEASE_NAME
6663 env :
67- IMAGE_TAG : ${{ github.sha }}
6864 AWS_ACCOUNT_ID : ${{ secrets.AWS_ACCOUNT_ID }}
6965 AWS_ACCESS_KEY_ID : ${{ secrets.GH_AWS_ACCESS_KEY_ID }}
7066 AWS_SECRET_ACCESS_KEY : ${{ secrets.GH_AWS_SECRET_ACCESS_KEY }}
71- DO_AUTH_TOKEN : ${{ secrets.DO_AUTH_TOKEN }}
72- K8S_CLUSTER_ID : ${{ secrets.K8S_CLUSTER_ID }}
73- REPOSITORY : ${{ github.repository }}
7467 needs : publish-publish
0 commit comments