From 947f45f5a842d855dfba3d0225f14a9b2632dd35 Mon Sep 17 00:00:00 2001 From: almeida-erick <102696058+almeida-erick@users.noreply.github.com> Date: Tue, 19 Apr 2022 16:41:26 -0500 Subject: [PATCH 1/5] TT-610-Time-Tracker-Keys-Pipeline-ENV (#845) * fix: TT-610 Fix pipeline * fix: TT-610 Fix pipeline - CI Time Tracker ui * fix: TT-610 Fix pipeline - read from OS env variable in .ts --- .github/workflows/CI-time-tracker-ui.yml | 4 ++-- Makefile | 6 +++--- scripts/populate-var-file.sh | 10 ++++++++++ scripts/setenv.ts | 17 ++++++++--------- 4 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 scripts/populate-var-file.sh diff --git a/.github/workflows/CI-time-tracker-ui.yml b/.github/workflows/CI-time-tracker-ui.yml index da410589a..f63625e00 100644 --- a/.github/workflows/CI-time-tracker-ui.yml +++ b/.github/workflows/CI-time-tracker-ui.yml @@ -48,8 +48,8 @@ jobs: 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 + chmod +x ./scripts/populate-var-file.sh + sh ./scripts/populate-var-file.sh - name: Running tests run: npm run ci-test --if-present diff --git a/Makefile b/Makefile index f465cfed1..98d231b11 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ cleanup: ## Delete image timetracker_ui .PHONY: run run: ## Execute timetracker_ui docker containe. - docker-compose --env-file ./.env up -d + docker-compose up -d .PHONY: logs logs: ## Show logs of timetracker_ui. @@ -40,12 +40,12 @@ remove: ## Delete container timetracker_ui. .PHONY: test test: ## Run all tests on docker container timetracker_ui at the CLI. - docker-compose -f docker-compose.yml --env-file ./.env up -d + docker-compose -f docker-compose.yml up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: testdev testdev: ## Run all tests on docker container timetracker_ui at the Dev - docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file ./.env up -d + docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: publish diff --git a/scripts/populate-var-file.sh b/scripts/populate-var-file.sh new file mode 100644 index 000000000..f395689af --- /dev/null +++ b/scripts/populate-var-file.sh @@ -0,0 +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 diff --git a/scripts/setenv.ts b/scripts/setenv.ts index 0c07a1b30..659a587b2 100644 --- a/scripts/setenv.ts +++ b/scripts/setenv.ts @@ -1,14 +1,13 @@ const { writeFile } = require('fs'); -require('dotenv').config(); const pathJs = `./src/environments/keys.ts` -const contentKeys = -`export const AUTHORITY = '${process.env.AUTHORITY}'; -export const CLIENT_ID = '${process.env.CLIENT_ID}'; -export const SCOPES = ['${process.env.SCOPES}']; -export const STACK_EXCHANGE_ID = '${process.env.STACK_EXCHANGE_ID}'; -export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env.STACK_EXCHANGE_ACCESS_TOKEN}'; -export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING}'; +const contentKeys = +`export const AUTHORITY = '${process.env["AUTHORITY"]}'; +export const CLIENT_ID = '${process.env["CLIENT_ID"]}'; +export const SCOPES = ['${process.env["SCOPES"]}']; +export const STACK_EXCHANGE_ID = '${process.env["STACK_EXCHANGE_ID"]}'; +export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env["STACK_EXCHANGE_ACCESS_TOKEN"]}'; +export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"]}'; `; writeFile(pathJs, contentKeys, function (err) { @@ -19,7 +18,7 @@ writeFile(pathJs, contentKeys, function (err) { }); const pathJson = `./src/environments/.keys.json` -const contentKeysJson = +const contentKeysJson = `{ "authority": "${process.env.AUTHORITY_JSON}", "client_id": "${process.env.CLIENT_ID_JSON}", From 48b36ccf2fb7d15c10f6bd41bf805c555b4c44bc Mon Sep 17 00:00:00 2001 From: sbateca Date: Tue, 19 Apr 2022 17:32:57 -0500 Subject: [PATCH 2/5] Revert "TT-610-Time-Tracker-Keys-Pipeline-ENV (#845)" (#848) This reverts commit 947f45f5a842d855dfba3d0225f14a9b2632dd35. --- .github/workflows/CI-time-tracker-ui.yml | 4 ++-- Makefile | 6 +++--- scripts/populate-var-file.sh | 10 ---------- scripts/setenv.ts | 17 +++++++++-------- 4 files changed, 14 insertions(+), 23 deletions(-) delete mode 100644 scripts/populate-var-file.sh diff --git a/.github/workflows/CI-time-tracker-ui.yml b/.github/workflows/CI-time-tracker-ui.yml index f63625e00..da410589a 100644 --- a/.github/workflows/CI-time-tracker-ui.yml +++ b/.github/workflows/CI-time-tracker-ui.yml @@ -48,8 +48,8 @@ jobs: 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-var-file.sh - sh ./scripts/populate-var-file.sh + chmod +x ./scripts/populate-keys.sh + sh ./scripts/populate-keys.sh - name: Running tests run: npm run ci-test --if-present diff --git a/Makefile b/Makefile index 98d231b11..f465cfed1 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ cleanup: ## Delete image timetracker_ui .PHONY: run run: ## Execute timetracker_ui docker containe. - docker-compose up -d + docker-compose --env-file ./.env up -d .PHONY: logs logs: ## Show logs of timetracker_ui. @@ -40,12 +40,12 @@ remove: ## Delete container timetracker_ui. .PHONY: test test: ## Run all tests on docker container timetracker_ui at the CLI. - docker-compose -f docker-compose.yml up -d + docker-compose -f docker-compose.yml --env-file ./.env up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: testdev testdev: ## Run all tests on docker container timetracker_ui at the Dev - docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d + docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file ./.env up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: publish diff --git a/scripts/populate-var-file.sh b/scripts/populate-var-file.sh deleted file mode 100644 index f395689af..000000000 --- a/scripts/populate-var-file.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 diff --git a/scripts/setenv.ts b/scripts/setenv.ts index 659a587b2..0c07a1b30 100644 --- a/scripts/setenv.ts +++ b/scripts/setenv.ts @@ -1,13 +1,14 @@ const { writeFile } = require('fs'); +require('dotenv').config(); const pathJs = `./src/environments/keys.ts` -const contentKeys = -`export const AUTHORITY = '${process.env["AUTHORITY"]}'; -export const CLIENT_ID = '${process.env["CLIENT_ID"]}'; -export const SCOPES = ['${process.env["SCOPES"]}']; -export const STACK_EXCHANGE_ID = '${process.env["STACK_EXCHANGE_ID"]}'; -export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env["STACK_EXCHANGE_ACCESS_TOKEN"]}'; -export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"]}'; +const contentKeys = +`export const AUTHORITY = '${process.env.AUTHORITY}'; +export const CLIENT_ID = '${process.env.CLIENT_ID}'; +export const SCOPES = ['${process.env.SCOPES}']; +export const STACK_EXCHANGE_ID = '${process.env.STACK_EXCHANGE_ID}'; +export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env.STACK_EXCHANGE_ACCESS_TOKEN}'; +export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING}'; `; writeFile(pathJs, contentKeys, function (err) { @@ -18,7 +19,7 @@ writeFile(pathJs, contentKeys, function (err) { }); const pathJson = `./src/environments/.keys.json` -const contentKeysJson = +const contentKeysJson = `{ "authority": "${process.env.AUTHORITY_JSON}", "client_id": "${process.env.CLIENT_ID_JSON}", From 74fac17ce0d067acc6be173367f71a87083e56df Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 19 Apr 2022 22:35:15 +0000 Subject: [PATCH 3/5] chore(release): 1.72.2 [skip ci]nn --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d2ad4cbb..c0296c159 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.72.1", + "version": "1.72.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 396d1b3fe..bd3ed01b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.72.1", + "version": "1.72.2", "scripts": { "config": "ts-node ./scripts/setenv.ts", "preinstall": "npx npm-force-resolutions", From 954a6179b1a269131c9a1eba75346f51735d856d Mon Sep 17 00:00:00 2001 From: sbateca Date: Tue, 19 Apr 2022 17:43:28 -0500 Subject: [PATCH 4/5] fix: TT-610 Fix pipeline (#849) Co-authored-by: Erick Almeida --- .github/workflows/CD-time-tracker-ui.yml | 4 ++-- .github/workflows/CI-time-tracker-ui.yml | 4 ++-- Makefile | 6 +++--- scripts/populate-var-file.sh | 10 ++++++++++ scripts/setenv.ts | 17 ++++++++--------- 5 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 scripts/populate-var-file.sh diff --git a/.github/workflows/CD-time-tracker-ui.yml b/.github/workflows/CD-time-tracker-ui.yml index db0ed3d19..5934939b6 100644 --- a/.github/workflows/CD-time-tracker-ui.yml +++ b/.github/workflows/CD-time-tracker-ui.yml @@ -35,8 +35,8 @@ jobs: 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 + chmod +x ./scripts/populate-var-file.sh + sh ./scripts/populate-var-file.sh - name: 'run: npm install and build' run: | diff --git a/.github/workflows/CI-time-tracker-ui.yml b/.github/workflows/CI-time-tracker-ui.yml index da410589a..f63625e00 100644 --- a/.github/workflows/CI-time-tracker-ui.yml +++ b/.github/workflows/CI-time-tracker-ui.yml @@ -48,8 +48,8 @@ jobs: 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 + chmod +x ./scripts/populate-var-file.sh + sh ./scripts/populate-var-file.sh - name: Running tests run: npm run ci-test --if-present diff --git a/Makefile b/Makefile index f465cfed1..98d231b11 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ cleanup: ## Delete image timetracker_ui .PHONY: run run: ## Execute timetracker_ui docker containe. - docker-compose --env-file ./.env up -d + docker-compose up -d .PHONY: logs logs: ## Show logs of timetracker_ui. @@ -40,12 +40,12 @@ remove: ## Delete container timetracker_ui. .PHONY: test test: ## Run all tests on docker container timetracker_ui at the CLI. - docker-compose -f docker-compose.yml --env-file ./.env up -d + docker-compose -f docker-compose.yml up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: testdev testdev: ## Run all tests on docker container timetracker_ui at the Dev - docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file ./.env up -d + docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d docker exec timetracker_ui bash -c "npm run ci-test" .PHONY: publish diff --git a/scripts/populate-var-file.sh b/scripts/populate-var-file.sh new file mode 100644 index 000000000..f395689af --- /dev/null +++ b/scripts/populate-var-file.sh @@ -0,0 +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 diff --git a/scripts/setenv.ts b/scripts/setenv.ts index 0c07a1b30..659a587b2 100644 --- a/scripts/setenv.ts +++ b/scripts/setenv.ts @@ -1,14 +1,13 @@ const { writeFile } = require('fs'); -require('dotenv').config(); const pathJs = `./src/environments/keys.ts` -const contentKeys = -`export const AUTHORITY = '${process.env.AUTHORITY}'; -export const CLIENT_ID = '${process.env.CLIENT_ID}'; -export const SCOPES = ['${process.env.SCOPES}']; -export const STACK_EXCHANGE_ID = '${process.env.STACK_EXCHANGE_ID}'; -export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env.STACK_EXCHANGE_ACCESS_TOKEN}'; -export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env.AZURE_APP_CONFIGURATION_CONNECTION_STRING}'; +const contentKeys = +`export const AUTHORITY = '${process.env["AUTHORITY"]}'; +export const CLIENT_ID = '${process.env["CLIENT_ID"]}'; +export const SCOPES = ['${process.env["SCOPES"]}']; +export const STACK_EXCHANGE_ID = '${process.env["STACK_EXCHANGE_ID"]}'; +export const STACK_EXCHANGE_ACCESS_TOKEN = '${process.env["STACK_EXCHANGE_ACCESS_TOKEN"]}'; +export const AZURE_APP_CONFIGURATION_CONNECTION_STRING = '${process.env["AZURE_APP_CONFIGURATION_CONNECTION_STRING"]}'; `; writeFile(pathJs, contentKeys, function (err) { @@ -19,7 +18,7 @@ writeFile(pathJs, contentKeys, function (err) { }); const pathJson = `./src/environments/.keys.json` -const contentKeysJson = +const contentKeysJson = `{ "authority": "${process.env.AUTHORITY_JSON}", "client_id": "${process.env.CLIENT_ID_JSON}", From 07b7778f3ee14ea0e09a07fabca2c26428de8202 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 19 Apr 2022 22:45:57 +0000 Subject: [PATCH 5/5] chore(release): 1.72.3 [skip ci]nn --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c0296c159..ca256d7b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.72.2", + "version": "1.72.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index bd3ed01b6..8f2b01355 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "time-tracker", - "version": "1.72.2", + "version": "1.72.3", "scripts": { "config": "ts-node ./scripts/setenv.ts", "preinstall": "npx npm-force-resolutions",