From 34bb9d171432cc85de97929bf7bf9f60aa447c68 Mon Sep 17 00:00:00 2001 From: blam Date: Sat, 28 Nov 2020 22:11:56 +0100 Subject: [PATCH 01/28] feat: add thugboat --- .tugboat/config.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .tugboat/config.yml diff --git a/.tugboat/config.yml b/.tugboat/config.yml new file mode 100644 index 0000000000..ef037c0d28 --- /dev/null +++ b/.tugboat/config.yml @@ -0,0 +1,4 @@ +services: + backstage: + build: + dockerfile: ./packages/backend/Dockerfile From dbea1562dcd808d4350e66deb37f64ea7f47133d Mon Sep 17 00:00:00 2001 From: blam Date: Sat, 28 Nov 2020 22:21:56 +0100 Subject: [PATCH 02/28] chore: rework tugboat build --- .tugboat/config.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index ef037c0d28..612cbdb5af 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -1,4 +1,9 @@ services: backstage: - build: - dockerfile: ./packages/backend/Dockerfile + image: tugboatqa/node:lts + commands: + init: + - yarn + - yarn build + start: + - yarn start-backend From b303ee9fb170cc639efdc3b883263c3147ea4fc3 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Dec 2020 13:11:40 +0100 Subject: [PATCH 03/28] chore: updating tugboat config to build and tsc --- .tugboat/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 612cbdb5af..14cfd6dc85 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -3,7 +3,8 @@ services: image: tugboatqa/node:lts commands: init: - - yarn + - yarn install + - yarn tsc - yarn build start: - yarn start-backend From 4ee32a78f140f69f68d875cd610d74e0d31202f0 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 1 Dec 2020 20:08:47 +0100 Subject: [PATCH 04/28] chore: set as default --- .tugboat/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 14cfd6dc85..b3195d6254 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -1,10 +1,11 @@ services: backstage: image: tugboatqa/node:lts + default: true commands: init: - yarn install - yarn tsc - yarn build start: - - yarn start-backend + - APP_CONFIG_backend_listen_port=80 yarn start-backend From e0f22774801788fd2584879c19eb2dfd923ebf46 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 2 Dec 2020 10:24:59 +0100 Subject: [PATCH 05/28] chore: fixing container port --- .tugboat/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index b3195d6254..ef696e28de 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -1,6 +1,7 @@ services: backstage: image: tugboatqa/node:lts + expose: 7000 default: true commands: init: @@ -8,4 +9,4 @@ services: - yarn tsc - yarn build start: - - APP_CONFIG_backend_listen_port=80 yarn start-backend + - yarn start-backend From 8caf5cb0eacc980ace3e295c94a35c9df4b0e12f Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 3 Dec 2020 00:15:30 +0100 Subject: [PATCH 06/28] chore: make the start-backend command backgrounded --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index ef696e28de..3bc8865493 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -9,4 +9,4 @@ services: - yarn tsc - yarn build start: - - yarn start-backend + - yarn start-backend & From 83006ba83ab31387bb0e10055f756fdfee790f6a Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 3 Dec 2020 00:17:51 +0100 Subject: [PATCH 07/28] chore: fixing some base build preview things --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 3bc8865493..20f716785c 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -4,7 +4,7 @@ services: expose: 7000 default: true commands: - init: + build: - yarn install - yarn tsc - yarn build From 5ad2d8b3be154037538244b61030d3230962bdfc Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 26 Jan 2021 20:14:27 +0100 Subject: [PATCH 08/28] chore: updating config for tugboat updating --- .tugboat/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 20f716785c..065cc4d526 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -8,5 +8,9 @@ services: - yarn install - yarn tsc - yarn build + update: + - yarn install + - yarn tsc + - yarn build start: - yarn start-backend & From 99e53017d03b00fa1d10e4eabdb0e2e55df1df95 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 26 Jan 2021 20:19:30 +0100 Subject: [PATCH 09/28] chore: reworking some more steps to see if this is how you build --- .tugboat/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 065cc4d526..4e393f2a6d 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -4,13 +4,13 @@ services: expose: 7000 default: true commands: - build: + init: - yarn install + build: - yarn tsc - yarn build update: - yarn install - - yarn tsc - - yarn build + - env start: - - yarn start-backend & + - node packages/backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From 59f9a5baad6294496af40b361528f5b98660da41 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 26 Jan 2021 20:44:57 +0100 Subject: [PATCH 10/28] feat: add in the tugboat config --- .tugboat/tugboat.app-config.production.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .tugboat/tugboat.app-config.production.yaml diff --git a/.tugboat/tugboat.app-config.production.yaml b/.tugboat/tugboat.app-config.production.yaml new file mode 100644 index 0000000000..f606574d89 --- /dev/null +++ b/.tugboat/tugboat.app-config.production.yaml @@ -0,0 +1,13 @@ +app: + title: Backstage Tugboat Preview + baseUrl: + $env: TUGBOAT_DEFAULT_SERVICE_URL + +backend: + baseUrl: + $env: TUGBOAT_DEFAULT_SERVICE_URL + cors: + origin: + $env: TUGBOAT_DEFAULT_SERVICE_URL + methods: [GET, POST, PUT, DELETE] + credentials: true From e877faa6eb5595605e5524f11168ce3926063099 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 26 Jan 2021 20:53:23 +0100 Subject: [PATCH 11/28] chore: fixing config --- .tugboat/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 4e393f2a6d..aaca7f6d86 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -11,6 +11,7 @@ services: - yarn build update: - yarn install - - env + - yarn tsc + - yarn build start: - node packages/backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From e20b984a374ecef1de0dd3349f77c5bd67f7a322 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 26 Jan 2021 21:37:49 +0100 Subject: [PATCH 12/28] chore: updating base image --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index aaca7f6d86..0c8c0329e3 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -1,6 +1,6 @@ services: backstage: - image: tugboatqa/node:lts + image: node:lts-alpine expose: 7000 default: true commands: From 4f6d779b78195f6ad86f303cd6c3e79933344b47 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 09:42:50 +0100 Subject: [PATCH 13/28] chore: run the built main for now, --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 0c8c0329e3..af30015047 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -14,4 +14,4 @@ services: - yarn tsc - yarn build start: - - node packages/backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & + - node packages/backend/dist/main --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From f683dfbee5af261cd344022d75c30d119775fdbc Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 10:02:19 +0100 Subject: [PATCH 14/28] chore: fixing config again --- .tugboat/config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index af30015047..d130f60554 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -1,6 +1,6 @@ services: backstage: - image: node:lts-alpine + image: tugboatqa/node:lts expose: 7000 default: true commands: @@ -14,4 +14,5 @@ services: - yarn tsc - yarn build start: - - node packages/backend/dist/main --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & + # This should be production, but we need to run backend:bundle like the dockerfile does. + - yarn start-backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From 233d519ca19ac180495a58a6a40d39e9aeebda09 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 10:23:53 +0100 Subject: [PATCH 15/28] chore: think this is what it's supposed to look like haha --- .tugboat/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index d130f60554..bdef387f3f 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -8,11 +8,9 @@ services: - yarn install build: - yarn tsc - - yarn build + - yarn build --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml update: - yarn install - - yarn tsc - - yarn build start: # This should be production, but we need to run backend:bundle like the dockerfile does. - yarn start-backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From 732701e4a7972d424cdd9b0cb75140261c359819 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 10:42:31 +0100 Subject: [PATCH 16/28] chore: Remove the build-config flag --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index bdef387f3f..4694800e50 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -8,7 +8,7 @@ services: - yarn install build: - yarn tsc - - yarn build --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml + - yarn build update: - yarn install start: From 15932ee95b808a0e3b961ab7417aae4b22b7eadd Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 11:17:12 +0100 Subject: [PATCH 17/28] chore: try different config --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 4694800e50..e06b95d7ef 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -13,4 +13,4 @@ services: - yarn install start: # This should be production, but we need to run backend:bundle like the dockerfile does. - - yarn start-backend --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & + - node packages/backend/dist/main --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & From 1aa7817271f79fd20c168d6c362607de8a82edc1 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 11:31:27 +0100 Subject: [PATCH 18/28] chore: hopefully getting something to boot now? --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index e06b95d7ef..831ea6a9b6 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -13,4 +13,4 @@ services: - yarn install start: # This should be production, but we need to run backend:bundle like the dockerfile does. - - node packages/backend/dist/main --config app-config.yaml --config .tugboat/tugboat.app-config.production.yaml & + - yarn start-backend --config $PWD/app-config.yaml --config $PWD/.tugboat/tugboat.app-config.production.yaml & From 45f49bd12c0d1255b19850ce7cfd72df6c3042c9 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 13:48:57 +0100 Subject: [PATCH 19/28] chore: performance! --- .tugboat/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 831ea6a9b6..7ee1a775e9 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -7,8 +7,7 @@ services: init: - yarn install build: - - yarn tsc - - yarn build + - yarn workspace example-app build update: - yarn install start: From e3d850a9e460ef2c131c4bc47d5d736db95e8d72 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 13:56:37 +0100 Subject: [PATCH 20/28] chore: try skip yarn for tty problems --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 7ee1a775e9..be952d601c 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -12,4 +12,4 @@ services: - yarn install start: # This should be production, but we need to run backend:bundle like the dockerfile does. - - yarn start-backend --config $PWD/app-config.yaml --config $PWD/.tugboat/tugboat.app-config.production.yaml & + - cd packages/backend && node_modules/.bin/backstage-cli backend:dev --config ../../app-config.yaml --config ../../.tugboat/tugboat.app-config.production.yaml & From f1d1ef4635523577f640bdcc406df22ef17aed17 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 14:35:11 +0100 Subject: [PATCH 21/28] chore: updating config --- .tugboat/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index be952d601c..2678f39540 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -12,4 +12,4 @@ services: - yarn install start: # This should be production, but we need to run backend:bundle like the dockerfile does. - - cd packages/backend && node_modules/.bin/backstage-cli backend:dev --config ../../app-config.yaml --config ../../.tugboat/tugboat.app-config.production.yaml & + - cd packages/backend && node_modules/.bin/backstage-cli backend:dev --config ../../app-config.yaml --config ../../.tugboat/tugboat.app-config.production.yaml From 3179c98c85c0240dc4842ff6bde1682bd6a1eeca Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 27 Jan 2021 14:49:04 +0100 Subject: [PATCH 22/28] chore: updating config again --- .tugboat/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.tugboat/config.yml b/.tugboat/config.yml index 2678f39540..2be043cd78 100644 --- a/.tugboat/config.yml +++ b/.tugboat/config.yml @@ -5,11 +5,11 @@ services: default: true commands: init: - - yarn install + - mkdir -p /etc/service/node + - echo "#!/bin/sh" > /etc/service/node/run + - echo "yarn --cwd ${TUGBOAT_ROOT} start-backend --config ${TUGBOAT_ROOT}/app-config.yaml --config ${TUGBOAT_ROOT}/.tugboat/tugboat.app-config.production.yaml" >> /etc/service/node/run + - chmod +x /etc/service/node/run build: - yarn workspace example-app build update: - yarn install - start: - # This should be production, but we need to run backend:bundle like the dockerfile does. - - cd packages/backend && node_modules/.bin/backstage-cli backend:dev --config ../../app-config.yaml --config ../../.tugboat/tugboat.app-config.production.yaml From 83a879c4cb4debe5531074be22acc5b430fc27e5 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 00:01:55 +0100 Subject: [PATCH 23/28] chore: add a simple github action workflow --- .github/workflows/tugboat.yml | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/tugboat.yml diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml new file mode 100644 index 0000000000..4c52ce99d6 --- /dev/null +++ b/.github/workflows/tugboat.yml @@ -0,0 +1,57 @@ +name: Tugboat E2E Tests +on: deployment_status + +jobs: + run: + # When the deployment event is success + if: github.event.deployment_status.state == 'success' + name: Run test suite against tugboat + runs-on: ubuntu-latest + steps: + # Set an initial commit status message to indicate that the tests are + # running. + - name: set pending status + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + debug: true + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: 'pending', + context: 'Nightwatch.js tests', + description: 'Running tests', + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }); + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '14' + - name: get deployment status + id: get-status-env + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + result-encoding: string + script: | + const result = await github.repos.getDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: context.payload.deployment.id, + status_id: context.payload.deployment_status.id, + headers: { + 'Accept': 'application/vnd.github.ant-man-preview+json' + }, + }); + console.log(result); + return result.data.environment_url; + - name: echo tugboat preview url + run: | + echo ${{ steps.get-status-env.outputs.result }} + # The first time you hit a Tugboat URL it can take a while to load, so + # we visit it once here to prime it. Otherwise the very first test + # will often timeout. + curl ${{ steps.get-status-env.outputs.result }} + From 3148751354df0cb62324d65ef64c66f90e1c53dc Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 00:12:52 +0100 Subject: [PATCH 24/28] chore: update workfloew --- .github/workflows/tugboat.yml | 107 ++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml index 4c52ce99d6..da67be58b4 100644 --- a/.github/workflows/tugboat.yml +++ b/.github/workflows/tugboat.yml @@ -2,56 +2,63 @@ name: Tugboat E2E Tests on: deployment_status jobs: - run: - # When the deployment event is success + run-tests: + # Only run after a successful Tugboat deployment. if: github.event.deployment_status.state == 'success' - name: Run test suite against tugboat + name: Run tests against Tugboat runs-on: ubuntu-latest - steps: - # Set an initial commit status message to indicate that the tests are - # running. - - name: set pending status - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - debug: true - script: | - return github.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: 'pending', - context: 'Nightwatch.js tests', - description: 'Running tests', - target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" - }); - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '14' - - name: get deployment status - id: get-status-env - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - result-encoding: string - script: | - const result = await github.repos.getDeploymentStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - deployment_id: context.payload.deployment.id, - status_id: context.payload.deployment_status.id, - headers: { - 'Accept': 'application/vnd.github.ant-man-preview+json' - }, - }); - console.log(result); - return result.data.environment_url; - - name: echo tugboat preview url - run: | - echo ${{ steps.get-status-env.outputs.result }} - # The first time you hit a Tugboat URL it can take a while to load, so - # we visit it once here to prime it. Otherwise the very first test - # will often timeout. - curl ${{ steps.get-status-env.outputs.result }} + steps: + # Set an initial commit status message to indicate that the tests are + # running. + - name: set pending status + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + debug: true + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: 'pending', + context: 'Nightwatch.js tests', + description: 'Running tests', + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + }); + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: '14' + + # This is required because the environment_url param that Tugboat uses + # to tell us where the preview is located isn't supported unless you + # specify the custom Accept header when getting the deployment_status, + # and GitHub actions doesn't do that by default. So instead we have to + # load the status object manually and get the data we need. + # https://developer.github.com/changes/2016-04-06-deployment-and-deployment-status-enhancements/ + - name: get deployment status + id: get-status-env + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + result-encoding: string + script: | + const result = await github.repos.getDeploymentStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + deployment_id: context.payload.deployment.id, + status_id: context.payload.deployment_status.id, + headers: { + 'Accept': 'application/vnd.github.ant-man-preview+json' + }, + }); + console.log(result); + return result.data.environment_url; + - name: echo tugboat preview url + run: | + echo ${{ steps.get-status-env.outputs.result }} + # The first time you hit a Tugboat URL it can take a while to load, so + # we visit it once here to prime it. Otherwise the very first test + # will often timeout. + curl ${{ steps.get-status-env.outputs.result }} From fca9de6c93b53395a994bfa2271f3e5ba84d7c3f Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 00:24:28 +0100 Subject: [PATCH 25/28] chore: update workflow again --- .github/workflows/tugboat.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml index da67be58b4..53fcd2e873 100644 --- a/.github/workflows/tugboat.yml +++ b/.github/workflows/tugboat.yml @@ -1,7 +1,29 @@ name: Tugboat E2E Tests on: deployment_status - jobs: + set-pending: + if: github.event.deployment_status.state != 'success' && github.event.deployment_status.state != 'failed' + name: Run tests against Tugboat + runs-on: ubuntu-latest + steps: + # Set an initial commit status message to indicate that the tests are + # running. + - name: set pending status + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + debug: true + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: 'pending', + context: 'Backstage Tugboat E2E Tests', + description: 'Running tests', + target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + }); + run-tests: # Only run after a successful Tugboat deployment. if: github.event.deployment_status.state == 'success' @@ -21,9 +43,9 @@ jobs: repo: context.repo.repo, sha: context.sha, state: 'pending', - context: 'Nightwatch.js tests', + context: 'Backstage Tugboat E2E Tests', description: 'Running tests', - target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" }); - uses: actions/checkout@v1 @@ -57,8 +79,8 @@ jobs: return result.data.environment_url; - name: echo tugboat preview url run: | - echo ${{ steps.get-status-env.outputs.result }} + echo ${{steps.get-status-env.outputs.result}} # The first time you hit a Tugboat URL it can take a while to load, so # we visit it once here to prime it. Otherwise the very first test # will often timeout. - curl ${{ steps.get-status-env.outputs.result }} + curl ${{steps.get-status-env.outputs.result}} From a4716e47276475f2424471df7fd126bcc9f484bb Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 00:50:44 +0100 Subject: [PATCH 26/28] chore: fixing deployments for real --- .github/workflows/tugboat.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml index 53fcd2e873..cce4df01de 100644 --- a/.github/workflows/tugboat.yml +++ b/.github/workflows/tugboat.yml @@ -3,7 +3,7 @@ on: deployment_status jobs: set-pending: if: github.event.deployment_status.state != 'success' && github.event.deployment_status.state != 'failed' - name: Run tests against Tugboat + name: Set pending waiting for Tugboat runs-on: ubuntu-latest steps: # Set an initial commit status message to indicate that the tests are @@ -20,14 +20,14 @@ jobs: sha: context.sha, state: 'pending', context: 'Backstage Tugboat E2E Tests', - description: 'Running tests', + description: 'Waiting for Tugboat to complete deployment', target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" }); run-tests: # Only run after a successful Tugboat deployment. if: github.event.deployment_status.state == 'success' - name: Run tests against Tugboat + name: Run tests against Tugboat deployment runs-on: ubuntu-latest steps: # Set an initial commit status message to indicate that the tests are @@ -44,7 +44,7 @@ jobs: sha: context.sha, state: 'pending', context: 'Backstage Tugboat E2E Tests', - description: 'Running tests', + description: 'Running against tugboat preview', target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" }); @@ -79,8 +79,4 @@ jobs: return result.data.environment_url; - name: echo tugboat preview url run: | - echo ${{steps.get-status-env.outputs.result}} - # The first time you hit a Tugboat URL it can take a while to load, so - # we visit it once here to prime it. Otherwise the very first test - # will often timeout. curl ${{steps.get-status-env.outputs.result}} From 408962dcead8301ae3885a7769264f117ea83fe0 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 01:17:52 +0100 Subject: [PATCH 27/28] chore: last github workflow plz --- .github/workflows/tugboat.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml index cce4df01de..3d6980c81e 100644 --- a/.github/workflows/tugboat.yml +++ b/.github/workflows/tugboat.yml @@ -80,3 +80,32 @@ jobs: - name: echo tugboat preview url run: | curl ${{steps.get-status-env.outputs.result}} + # Update the commit status with a fail or success. + - name: set status + if: ${{ success() }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: "success", + context: 'Backstage Tugboat E2E Tests', + target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + }); + - name: set status + if: ${{ failure() }} || ${{ cancelled() }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: "error", + context: 'Backstage Tugboat E2E Tests', + target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + }); From 99460a64371c4b2604e151088f86463fb6635c2b Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 28 Jan 2021 10:45:16 +0100 Subject: [PATCH 28/28] chore: updating workflow --- .github/workflows/tugboat.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/tugboat.yml b/.github/workflows/tugboat.yml index 3d6980c81e..fdb2e1ddc4 100644 --- a/.github/workflows/tugboat.yml +++ b/.github/workflows/tugboat.yml @@ -80,7 +80,20 @@ jobs: - name: echo tugboat preview url run: | curl ${{steps.get-status-env.outputs.result}} - # Update the commit status with a fail or success. + - name: set status + if: ${{ failure() }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} + script: | + return github.repos.createCommitStatus({ + owner: context.repo.owner, + repo: context.repo.repo, + sha: context.sha, + state: "error", + context: 'Backstage Tugboat E2E Tests', + target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" + }); - name: set status if: ${{ success() }} uses: actions/github-script@v3 @@ -95,17 +108,3 @@ jobs: context: 'Backstage Tugboat E2E Tests', target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" }); - - name: set status - if: ${{ failure() }} || ${{ cancelled() }} - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GH_SERVICE_ACCOUNT_TOKEN}} - script: | - return github.repos.createCommitStatus({ - owner: context.repo.owner, - repo: context.repo.repo, - sha: context.sha, - state: "error", - context: 'Backstage Tugboat E2E Tests', - target_url: "https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" - });