diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index 7e2c5aa..114bfc9 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -10,10 +10,10 @@ env: GITHUB_SHA: ${{ github.sha }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }} + DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }} PROJECT_ID: ${{ secrets.GKE_PROJECT }} - GKE_CLUSTER: wisp-prod - GKE_ZONE: northamerica-northeast1-c + GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} + GKE_ZONE: ${{ secrets.GKE_ZONE }} IMAGE: wisp-users jobs: @@ -21,53 +21,52 @@ jobs: name: Setup, Build, Tag, Publish, and Deploy runs-on: ubuntu-latest steps: - - # Checkout Commit - - name: Checkout - uses: actions/checkout@v2 + # Checkout Commit + - name: Checkout + uses: actions/checkout@v2 # Setup gcloud CLI - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - with: - service_account_key: ${{ secrets.GKE_SA_KEY }} - project_id: ${{ secrets.GKE_PROJECT }} + - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + with: + service_account_key: ${{ secrets.GKE_SA_KEY }} + project_id: ${{ secrets.GKE_PROJECT }} + + # Configure Docker to use the gcloud command-line tool as a credential + # helper for authentication + - run: |- + gcloud --quiet auth configure-docker + - run: |- + gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" - # Configure Docker to use the gcloud command-line tool as a credential - # helper for authentication - - run: |- - gcloud --quiet auth configure-docker - - run: |- - gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" + # Build the Docker image + - name: Build + run: | + docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) . - # Build the Docker image - - name: Build - run: | - docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) . - - # Tag the Docker image - - name: Tag - run: | - docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":dev-latest + # Tag the Docker image + - name: Tag + run: | + docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":dev-latest - # Push the Docker image to Dockerhub - - name: Publish - run: | - docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD - docker push $DOCKER_ORGANIZATION/$IMAGE - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + # Push the Docker image to Dockerhub + - name: Publish + run: | + docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD + docker push $DOCKER_ORGANIZATION/$IMAGE + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - # Install helm for use in pipeline - - name: Install helm - run: | - wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 - chmod 700 get_helm.sh - ./get_helm.sh + # Install helm for use in pipeline + - name: Install helm + run: | + wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 + chmod 700 get_helm.sh + ./get_helm.sh - # Deploy to GKE cluster using helm - - name: Deploy - run: |- - helm upgrade --atomic --install dev-users ./chart/wisp-users/ --namespace dev --set image.tag=dev-$(echo ${GITHUB_SHA} | cut -c1-8) + # Deploy to GKE cluster using helm + - name: Deploy + run: |- + helm upgrade --atomic --install dev-users ./chart/wisp-users/ --namespace dev --set image.tag=dev-$(echo ${GITHUB_SHA} | cut -c1-8) e2e: needs: setup-build-tag-publish-deploy @@ -76,4 +75,4 @@ jobs: - uses: actions/checkout@v2 - run: wget https://raw.githubusercontent.com/Compete-McGill/wisp/master/e2e/docker-compose.yaml -O docker-compose.e2e.yaml - run: docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD - - run: docker-compose -f docker-compose.e2e.yaml up --abort-on-container-exit \ No newline at end of file + - run: docker-compose -f docker-compose.e2e.yaml up --abort-on-container-exit diff --git a/.github/workflows/prod.yaml b/.github/workflows/prod.yaml index 49b5304..0612c0b 100644 --- a/.github/workflows/prod.yaml +++ b/.github/workflows/prod.yaml @@ -10,10 +10,10 @@ env: GITHUB_SHA: ${{ github.sha }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }} + DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }} PROJECT_ID: ${{ secrets.GKE_PROJECT }} - GKE_CLUSTER: wisp-prod - GKE_ZONE: northamerica-northeast1-c + GKE_CLUSTER: ${{ secrets.GKE_CLUSTER }} + GKE_ZONE: ${{ secrets.GKE_ZONE }} IMAGE: wisp-users jobs: @@ -21,50 +21,49 @@ jobs: name: Setup, Build, Tag, and Publish runs-on: ubuntu-latest steps: + # Checkout Commit + - name: Checkout + uses: actions/checkout@v2 - # Checkout Commit - - name: Checkout - uses: actions/checkout@v2 + # Setup gcloud CLI + - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master + with: + service_account_key: ${{ secrets.GKE_SA_KEY }} + project_id: ${{ secrets.GKE_PROJECT }} - # Setup gcloud CLI - - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master - with: - service_account_key: ${{ secrets.GKE_SA_KEY }} - project_id: ${{ secrets.GKE_PROJECT }} + # Configure Docker to use the gcloud command-line tool as a credential + # helper for authentication + - run: |- + gcloud --quiet auth configure-docker + - run: |- + gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" - # Configure Docker to use the gcloud command-line tool as a credential - # helper for authentication - - run: |- - gcloud --quiet auth configure-docker - - run: |- - gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE" + # Build the Docker image + - name: Build + run: | + docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) . - # Build the Docker image - - name: Build - run: | - docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) . - - # Tag the Docker image - - name: Tag - run: | - docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":latest + # Tag the Docker image + - name: Tag + run: | + docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":latest - # Push the Docker image to Dockerhub - - name: Publish - run: | - docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD - docker push $DOCKER_ORGANIZATION/$IMAGE - env: - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + # Push the Docker image to Dockerhub + - name: Publish + run: | + docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD + docker push $DOCKER_ORGANIZATION/$IMAGE + env: + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - # Install helm for use in pipeline - - name: Install helm - run: | - wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 - chmod 700 get_helm.sh - ./get_helm.sh + # Install helm for use in pipeline + - name: Install helm + run: | + wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 + chmod 700 get_helm.sh + ./get_helm.sh - # Deploy to GKE cluster using helm - - name: Deploy - run: |- - helm upgrade --atomic --install prod-users ./chart/wisp-users/ --namespace prod --set image.tag=$(echo ${GITHUB_SHA} | cut -c1-8) --set replicaCount=2 \ No newline at end of file + # Deploy to GKE cluster using helm + - name: Deploy + run: |- + helm upgrade --atomic --install prod-users ./chart/wisp-users/ --namespace prod --set image.tag=$(echo ${GITHUB_SHA} | cut -c1-8) --set replicaCount=2 diff --git a/.prettierrc.js b/.prettierrc.js index 9831d86..94825f9 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,6 +1,14 @@ module.exports = { - semi: true, - trailingComma: "none", - singleQuote: false, - tabWidth: 4 -}; \ No newline at end of file + semi: true, + trailingComma: "none", + singleQuote: false, + tabWidth: 4, + overrides: [ + { + files: ["*.yaml"], + options: { + tabWidth: 2 + } + } + ] +};