Skip to content

Commit 8925d61

Browse files
committed
...
1 parent bfd9d63 commit 8925d61

File tree

5 files changed

+62
-0
lines changed

5 files changed

+62
-0
lines changed

.github/workflows/ci-cd-main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,40 @@ env:
3232
CI_ARTIFACTS_RUN_NUMBER: 329 # ${{ github.event.inputs.ci_artifacts_run_number || github.run_number }}
3333

3434
jobs:
35+
test:
36+
runs-on: ubuntu-24.04
37+
environment: deploy
38+
permissions:
39+
id-token: write
40+
steps:
41+
- uses: actions/github-script@v7
42+
id: get-id-token
43+
# if: github.ref == 'refs/heads/main'
44+
with:
45+
script: |
46+
const fs = require('fs');
47+
const token = await core.getIDToken('backend.fullstaqruby.org');
48+
fs.writeFileSync(
49+
process.env.GITHUB_OUTPUT,
50+
`id_token<<EOF\n${token}\nEOF\n`,
51+
{ flag: 'a' }
52+
);
53+
54+
- name: Restart web server
55+
run: ./internal-scripts/ci-cd/publish/restart-web-server.rb
56+
# if: github.ref == 'refs/heads/main'
57+
env:
58+
ID_TOKEN: ${{ steps.get-id-token.outputs.id_token }}
59+
60+
- run: 'false'
61+
3562
# Determines which jobs should be run, or (in case this is a re-run)
3663
# which jobs can be skipped this time because the last run succeeded.
3764
# We determine this by checking whether the artifacts produced by jobs
3865
# exist in this run.
3966
determine_necessary_jobs:
4067
name: Determine necessary jobs
68+
needs: test
4169
runs-on: ubuntu-24.04
4270
environment: test
4371
permissions:

.github/workflows/ci-cd-main.yml.erb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,40 @@ env:
2222
CI_ARTIFACTS_RUN_NUMBER: 329 # ${{ github.event.inputs.ci_artifacts_run_number || github.run_number }}
2323

2424
jobs:
25+
test:
26+
runs-on: ubuntu-24.04
27+
environment: deploy
28+
permissions:
29+
id-token: write
30+
steps:
31+
- uses: actions/github-script@v7
32+
id: get-id-token
33+
# if: github.ref == 'refs/heads/main'
34+
with:
35+
script: |
36+
const fs = require('fs');
37+
const token = await core.getIDToken('backend.fullstaqruby.org');
38+
fs.writeFileSync(
39+
process.env.GITHUB_OUTPUT,
40+
`id_token<<EOF\n${token}\nEOF\n`,
41+
{ flag: 'a' }
42+
);
43+
44+
- name: Restart web server
45+
run: ./internal-scripts/ci-cd/publish/restart-web-server.rb
46+
# if: github.ref == 'refs/heads/main'
47+
env:
48+
ID_TOKEN: ${{ steps.get-id-token.outputs.id_token }}
49+
50+
- run: 'false'
51+
2552
# Determines which jobs should be run, or (in case this is a re-run)
2653
# which jobs can be skipped this time because the last run succeeded.
2754
# We determine this by checking whether the artifacts produced by jobs
2855
# exist in this run.
2956
determine_necessary_jobs:
3057
name: Determine necessary jobs
58+
needs: test
3159
runs-on: ubuntu-24.04
3260
environment: test
3361
permissions:

.github/workflows/ci-cd-publish-test-production.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ jobs:
112112

113113
- uses: actions/github-script@v7
114114
id: get-id-token
115+
# if: github.ref == 'refs/heads/main'
115116
with:
116117
script: |
117118
const fs = require('fs');
@@ -124,6 +125,7 @@ jobs:
124125
125126
- name: Restart web server
126127
run: ./internal-scripts/ci-cd/publish/restart-web-server.rb
128+
# if: github.ref == 'refs/heads/main'
127129
env:
128130
ID_TOKEN: ${{ steps.get-id-token.outputs.id_token }}
129131

.github/workflows/ci-cd-publish-test-production.yml.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ jobs:
102102

103103
- uses: actions/github-script@v7
104104
id: get-id-token
105+
# if: github.ref == 'refs/heads/main'
105106
with:
106107
script: |
107108
const fs = require('fs');
@@ -114,6 +115,7 @@ jobs:
114115

115116
- name: Restart web server
116117
run: ./internal-scripts/ci-cd/publish/restart-web-server.rb
118+
# if: github.ref == 'refs/heads/main'
117119
env:
118120
ID_TOKEN: ${{ steps.get-id-token.outputs.id_token }}
119121

internal-scripts/ci-cd/publish/restart-web-server.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def main
3030

3131
log_notice 'Waiting until web server is restarted'
3232
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + TIMEOUT_SECS
33+
puts "deadline = #{deadline}"
3334
while true
35+
puts "current time = #{Process.clock_gettime(Process::CLOCK_MONOTONIC)}"
3436
if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline
3537
abort('ERROR: Timed out waiting for web server to restart')
3638
end

0 commit comments

Comments
 (0)