-
Notifications
You must be signed in to change notification settings - Fork 1
Tt 513 create ci/cd pipeline in timer tracker UI to deploy changes for both environments #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
santii90ec
merged 43 commits into
master
from
TT-513-Create-CI/CD-pipeline-in-timer-tracker-ui-to-deploy-changes-for-both-environments
Mar 25, 2022
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
62d569b
feat: TT-509 Use terraform to provision ui infraestructure
jatobrun 3fe4e5e
fix: TT-509 expose port 8080 in docker images
jatobrun 6cc64e6
fix: TT-509 change app to port 80
jatobrun 483cf6a
fix: TT-509 including empty line in all files
jatobrun a4b8426
fix: TT-509 Change the dockerfile to use root user and not app user
jatobrun da8e769
parent bf8977e79ef18ac85a09f9c55b213c72146c0de7
heikergil 06735a0
fix: TT-513 tests cd-stage.yml
heikergil 09235cf
feat: TT-513 CD - Prod yaml file
santii90ec d85bbe2
fix: TT-513 tests azure credentials
heikergil 9cce0c9
fix: TT-513 change image tag variable
heikergil 8b6fd37
fix: TT-513 add acr
heikergil 81dae65
fix: TT-513 fix make publish
heikergil 16671fe
fix: TT-513 fix make
heikergil 0e496cc
fix: TT-513 change acr
heikergil cb9246a
feat: TT-513 cli test and dev test make file
santii90ec aebce8d
Merge branch 'TT-513-Create-CI/CD-pipeline-in-timer-tracker-ui-to-dep…
santii90ec b434d10
Merge branch 'TT-513-Create-CI/CD-pipeline-in-timer-tracker-ui-to-dep…
heikergil dd8f99d
TT-513 fix make publish command
heikergil fcd887c
fix: TT-513 change registry url
heikergil 4a60730
fix: TT-513 fix registry url
heikergil 15af506
fix: TT-513 test CI/CD pipeline
heikergil e5a3dd1
fix: TT-513 tests cd/ci make build
heikergil ab6e6fe
fix: TT-513 test tf init on ci/cd
heikergil 9740043
fix: TT-513 test tags
heikergil b732dc4
fix: TT-513 Fix CI on all PR
santii90ec 9bd67e5
fix: TT-513 Fix CI pipeline
santii90ec f8c817c
fix: TT-513 Fix Make file for dev testing
santii90ec 214e563
fix: TT-513 fix make publish
heikergil be6524b
delete comments
heikergil 02591f8
fix: TT-513 Fix CI on all PR
santii90ec 43042db
fix: TT-513 fix make publish
heikergil 301182c
fix: TT-509 Change the dockerfile to use root user and not app user
jatobrun 4dd2f95
delete comments
heikergil 4a8aa30
fix: TT-513 Merge with master
santii90ec 254190e
fix: TT-513 master rebase
heikergil 4148493
fix: TT-513 change make publish
heikergil 82f6b3e
fix: TT-513 fix dockerfile
heikergil 56b6deb
TT-513: Fix ci pipeline
faustocv b725aa2
TT-513: Triggering pipeline in all branches. WIP
faustocv 83b0e86
fix: TT-513 add acr variable to make login
heikergil edb2b75
TT-513: Triggering TF plan in all branches
faustocv d7727e2
TT-513: Makes cd stage pipeline more readable
faustocv 25a587b
TT-513: Makes cd stage pipeline more readable
faustocv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
parent bf8977e
author Heiker Gil <[email protected]> 1646927329 -0500 committer Santiago Atapuma <[email protected]> 1647463991 -0500 parent bf8977e author Heiker Gil <[email protected]> 1646927329 -0500 committer Santiago Atapuma <[email protected]> 1647463401 -0500 fix: TT-513 CI/CD fix files feat: TT-513 cd-stage workflows feat: TT-513 fix indent cd-stage.yml feat: TT-513 fix indent cd-stage.yml fix: TT-513 fix indent cd-stage.yml feat: TT-513 add ci.yml feat: TT-513 add ci.yml fix: TT-513 fix ci.yml fix: TT-513 ci.yml feat: TT-513 add cd-prod.yml Update time-tracker-ui-ci.yml fix: TT-513 ci.yml Update time-tracker-ui-ci.yml feat: TT-513 environment variables fix: TT-513 .env variables fix: TT-513 env variables fix: TT-513 fix make file fix: TT-513 install chrome with dockerfile fix: TT-513 install chrome on docker container fix: TT-513 fix docker file fix: karma.conf.js to run headless fix: TT-513 change tests to ci-test scrip fix: TT-513 fix docker file fix: TT-513 karma testing fix: TT-513 add chrome to docker img fix: TT-513 change chrome download url fix: TT-513 fix chorme install fix: TT-513 change make to ci-test fix: TT-513 fix coverage fix: TT-513 fix permissions fix: TT-513 Fix Permissions in home fix: TT-513 fix permissions fix: TT-513 fix permissions fix: TT-573 fix permission} fix: TT-513 fix permissions fix: TT-573 fix permissions fix: TT-513 Fix permissions fix: TT-513 fix permissions fix: TT-513 Fix Permissions fix: TT-513 Fix Permissions fix: TT-513 Permissions fix: TT-513 disable karma coverage test fix: TT-513 Fix CLI
- Loading branch information
commit da8e769c28d8345a3de945edf7105eb167c7974d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: time-tracker-ui-cd-prod | ||
|
|
||
| on: | ||
| release: | ||
| types: | ||
| - published | ||
|
|
||
| jobs: | ||
| cd: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TF_WORKSPACE: prod | ||
| WORKING_DIR: infrastructure/ | ||
| ARM_CLIENT_ID: ${{secrets.TF_ARM_CLIENT_ID}} | ||
| ARM_CLIENT_SECRET: ${{secrets.TF_ARM_CLIENT_SECRET}} | ||
| ARM_SUBSCRIPTION_ID: ${{secrets.TF_ARM_SUBSCRIPTION_ID}} | ||
| ARM_TENANT_ID: ${{secrets.TF_ARM_TENANT_ID}} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Get the release_version | ||
| run: | | ||
| echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
| echo $RELEASE_VERSION | ||
| - name: Login to azure | ||
| uses: Azure/login@v1 | ||
| with: | ||
| creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
|
|
||
| - name: Build the docker image | ||
| run: make build | ||
|
|
||
| - name: Publish docker image to prod azure container registry | ||
| run: | | ||
| make login publish acr=timetrackerserviceprodregistry image_tag=$RELEASE_VERSION | ||
| - name: Setup terraform | ||
| uses: hashicorp/setup-terraform@v1 | ||
|
|
||
| - name: Authenticate with the TF modules repository | ||
| uses: webfactory/[email protected] | ||
| with: | ||
| ssh-private-key: ${{ secrets.INFRA_TERRAFORM_MODULES_SSH_PRIV_KEY }} | ||
|
|
||
| - name: Terraform Init | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| run: terraform init | ||
|
|
||
| - name: Terraform Apply | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| run: terraform apply -lock=false -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| name: time-tracker-ui-cd-stage | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*.*.*' | ||
|
|
||
| jobs: | ||
| cd: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| TF_WORKSPACE: stage | ||
| WORKING_DIR: infrastructure/ | ||
| ARM_CLIENT_ID: ${{secrets.TF_ARM_CLIENT_ID}} | ||
| ARM_CLIENT_SECRET: ${{secrets.TF_ARM_CLIENT_SECRET}} | ||
| ARM_SUBSCRIPTION_ID: ${{secrets.TF_ARM_SUBSCRIPTION_ID}} | ||
| ARM_TENANT_ID: ${{secrets.TF_ARM_TENANT_ID}} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| - name: Get the release_version | ||
| run: | | ||
| echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
| echo $RELEASE_VERSION | ||
| - name: Login to azure | ||
| uses: Azure/login@v1 | ||
| with: | ||
| creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
| - name: Build the docker image | ||
| run: make build | ||
| - name: Publish docker image to stage azure container registry | ||
| run: | | ||
| make login publish acr=timetrackerservicestageregistry image_tag=$RELEASE_VERSION | ||
| - name: Setup terraform | ||
| uses: hashicorp/setup-terraform@v1 | ||
| - name: Authenticate with the TF modules repository | ||
| uses: webfactory/[email protected] | ||
| with: | ||
| ssh-private-key: ${{ secrets.INFRA_TERRAFORM_MODULES_SSH_PRIV_KEY }} | ||
| - name: Terraform Init | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| run: terraform init | ||
| - name: Terraform Apply | ||
| working-directory: ${{ env.WORKING_DIR }} | ||
| run: terraform apply -lock=false -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| name: time-tracker-ui-ci | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - TT-513-Create-CI/CD-pipeline-in-timer-tracker-ui-to-deploy-changes-for-both-environments | ||
|
|
||
| pull_request: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| ci: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| WORKING_DIR: infrastructure/ | ||
| DB_CONNECTION: ${{ secrets.DB_CONNECTION }} | ||
| ARM_CLIENT_ID: ${{secrets.TF_ARM_CLIENT_ID}} | ||
| ARM_CLIENT_SECRET: ${{secrets.TF_ARM_CLIENT_SECRET}} | ||
| ARM_SUBSCRIPTION_ID: ${{secrets.TF_ARM_SUBSCRIPTION_ID}} | ||
| ARM_TENANT_ID: ${{secrets.TF_ARM_TENANT_ID}} | ||
| strategy: | ||
| max-parallel: 5 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Authenticate with the TF modules repository | ||
| uses: webfactory/[email protected] | ||
| with: | ||
| ssh-private-key: ${{ secrets.INFRA_TERRAFORM_MODULES_SSH_PRIV_KEY }} | ||
|
|
||
| # ci-test: | ||
| # name: Unit tests and CodeCoverage | ||
| # timeout-minutes: 90 | ||
| # steps: | ||
| # - name: Set up Node.js version | ||
| # uses: actions/setup-node@v1 | ||
| # with: | ||
| # node-version: '12.x' | ||
|
|
||
| # - name: Install dependencies | ||
| # run: npm install | ||
heikergil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - name: build docker | ||
| run: make build | ||
|
|
||
| - name: Inject Secrets | ||
| env: | ||
| SCOPES: ${{ secrets.SCOPES }} | ||
| CLIENT_ID: ${{ secrets.CLIENT_ID }} | ||
| AUTHORITY: ${{ secrets.AUTHORITY }} | ||
| STACK_EXCHANGE_ID: ${{ secrets.STACK_EXCHANGE_ID }} | ||
| STACK_EXCHANGE_ACCESS_TOKEN: ${{ secrets.STACK_EXCHANGE_ACCESS_TOKEN }} | ||
| AZURE_APP_CONFIGURATION_CONNECTION_STRING: ${{ secrets.AZURE_APP_CONFIGURATION_CONNECTION_STRING }} | ||
| run: | | ||
| chmod +x ./scripts/populate-keys.sh | ||
| sh ./scripts/populate-keys.sh | ||
|
|
||
| - name: Running tests | ||
| run: | | ||
| chmod -R 777 ./$home | ||
| make test | ||
| - name: Generate coverage report | ||
| env: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
| run: bash <(curl -s https://codecov.io/bash) | ||
|
|
||
| - name: Setup terraform | ||
| uses: hashicorp/setup-terraform@v1 | ||
|
|
||
| - name: 'Terraform Init' | ||
| id: init | ||
| working-directory: ./${{ env.WORKING_DIR }} | ||
| run: terraform init | ||
|
|
||
| - name: 'Terraform validate' | ||
| id: validate | ||
| working-directory: ./${{ env.WORKING_DIR }} | ||
| run: terraform validate | ||
|
|
||
| - name: Terraform Plan Stage | ||
| id: plan-stage | ||
| if: github.event_name == 'pull_request' | ||
| run: terraform plan -var-file=${{ env.TF_WORKSPACE }}.tfvars -no-color | ||
| continue-on-error: true | ||
heikergil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| working-directory: ./${{ env.WORKING_DIR }} | ||
| env: | ||
| TF_WORKSPACE: stage | ||
|
|
||
| - name: Terraform Plan Prod | ||
| id: plan-prod | ||
| if: github.event_name == 'pull_request' | ||
| run: terraform plan -var-file=${{ env.TF_WORKSPACE }}.tfvars -no-color | ||
| continue-on-error: true | ||
heikergil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| working-directory: ./${{ env.WORKING_DIR }} | ||
| env: | ||
| TF_WORKSPACE: prod | ||
|
|
||
| - name: Update Pull Request with Stage Plan | ||
| uses: actions/[email protected] | ||
| if: github.event_name == 'pull_request' | ||
| env: | ||
| PLAN: "terraform\n${{ steps.plan-stage.outputs.stdout }}" | ||
| TF_WORKSPACE: stage | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const output = `#### [${{ env.WORKING_DIR }}][${{ env.TF_WORKSPACE }}] Terraform Plan 📖 \`${{ steps.plan-stage.outcome }}\` | ||
| <details><summary>Show Plan</summary> | ||
| \`\`\`\n | ||
| ${process.env.PLAN} | ||
| \`\`\` | ||
| </details> | ||
| *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
| github.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: output | ||
| }) | ||
| - name: Update Pull Request with Prod Plan | ||
| uses: actions/[email protected] | ||
| if: github.event_name == 'pull_request' | ||
| env: | ||
| PLAN: "terraform\n${{ steps.plan-prod.outputs.stdout }}" | ||
| TF_WORKSPACE: prod | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| script: | | ||
| const output = `#### [${{ env.WORKING_DIR }}][${{ env.TF_WORKSPACE }}] Terraform Plan 📖 \`${{ steps.plan-prod.outcome }}\` | ||
| <details><summary>Show Plan</summary> | ||
| \`\`\`\n | ||
| ${process.env.PLAN} | ||
| \`\`\` | ||
| </details> | ||
| *Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`; | ||
| github.issues.createComment({ | ||
| issue_number: context.issue.number, | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| body: output | ||
| }) | ||
| - name: Terraform Plan Stage Status | ||
| if: steps.plan-stage.outcome == 'failure' | ||
| run: exit 1 | ||
|
|
||
| - name: Terraform Plan Prod Status | ||
| if: steps.plan-prod.outcome == 'failure' | ||
| run: exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| #!/bin/bash | ||
|
|
||
| > src/environments/keys.ts | ||
| echo 'export const AUTHORITY = "'$AUTHORITY'";' >> src/environments/keys.ts | ||
| echo 'export const CLIENT_ID = "'$CLIENT_ID'";' >> src/environments/keys.ts | ||
| echo 'export const SCOPES = ["'$SCOPES'"];' >> src/environments/keys.ts | ||
| echo 'export const STACK_EXCHANGE_ID = "'$STACK_EXCHANGE_ID'";' >> src/environments/keys.ts | ||
| echo 'export const STACK_EXCHANGE_ACCESS_TOKEN = "'$STACK_EXCHANGE_ACCESS_TOKEN'";' >> src/environments/keys.ts | ||
| echo 'export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = "'$AZURE_APP_CONFIGURATION_CONNECTION_STRING'";' >> src/environments/keys.ts | ||
| cat src/environments/keys.ts | ||
| > .env | ||
| echo 'AUTHORITY = '$AUTHORITY'' >> .env | ||
| echo 'CLIENT_ID = '$CLIENT_ID'' >> .env | ||
| echo 'SCOPES = '$SCOPES'' >> .env | ||
| echo 'STACK_EXCHANGE_ID = '$STACK_EXCHANGE_ID'' >> .env | ||
| echo 'STACK_EXCHANGE_ACCESS_TOKEN = '$STACK_EXCHANGE_ACCESS_TOKEN'' >> .env | ||
| echo 'AZURE_APP_CONFIGURATION_CONNECTION_STRING = '$AZURE_APP_CONFIGURATION_CONNECTION_STRING'' >> .env | ||
| cat .env |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this step is throwing an error on GitHub Actions