-
Notifications
You must be signed in to change notification settings - Fork 213
Use pre-built images for nginx & service containers #895
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
Open
alxndrsn
wants to merge
100
commits into
getodk:next
Choose a base branch
from
alxndrsn:another-try
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 92 commits
Commits
Show all changes
100 commits
Select commit
Hold shift + click to select a range
3ea7fed
ci: move to GHA; only run ghcr build on test pass AND when tagged
fc12898
fix shellcheck?
4b71f94
fix docker-compose build context
1a628d7
volume paths
46d2e17
ci: comment out working stuff
cde1280
service.dockerfile: separate unrelated commands
f9bb335
fix runner name
fb8e409
check path with available tools
1850615
1..timeout
ae7d2c9
for inc loop
6cf7ab9
store result before testing
12845ff
less subprocess
67b46a3
store res correct
d93db3d
remove circle config
cbadcde
get container name
4021da7
fix syntax hilighting
255cffc
no container: prefix
0c775f0
start container before getting name
69e78f3
rename var
3e32f1d
exec
f65e7f4
add logging
798dddc
remove noisy x
6a213fe
restructure
5cb2235
update check regex
11cb7a8
clearer code
ae5c3ea
remove nginxContainer var
cbc2970
test images
213d2f9
add docker compose logs
d868b92
X
0a006ae
or true?
acc1147
use a temp file
02fd5b1
single line
1f9a31e
redirect to stdout
f4b4456
run it
f20b090
log spacing
cdbefa0
show pm2 before count
4fe3ab6
8
63faeef
expect 4
ef321d9
enable all jobs
ba1f34d
clearer logging, comments
d09653e
docker-compose: use published images
9f190bd
use snapshots but not for root docker-compos
0dfed52
use both docker-compose files
9c85d21
ci: add TODO
8a54f30
fix compose file order
12e7ab8
fix context
ba309a5
remove explicit context
e9c8398
ghcr: show expected tag
3bcb62c
run ghcr job
dbdb893
docker run
fea2130
try execute?
9241ef1
try wider conditionsal
bb5a230
comment
660d375
comment out test yml
20580f9
print event name
86a263a
move test yml out the way
e6e20cc
fix yml
7cb5681
more devbug - tags etc
2e515d9
remove TODO
d49c273
no need
b26af10
ref type
16f40d0
try check only on tag
2d5d2be
ref_type
f51b8ac
simplify if the second half runs
9a3fd05
reinstate tings
4a4ac7e
reinstate test
9b8194e
revert dockerfile changes
69a915c
don't build on master
2747301
run test on tag
08893b7
expicitly run on tags
c3f255a
more restruct
75e711c
Testing build triggers
alxndrsn 851adbc
rebuild
f1415df
Merge branch 'next' into another-try
b48180e
build on pushes (check it still builds on tags...)
a7e5518
simplify/revert yaml
6e01960
Add debug job
e653b26
fix yaml?
d66ac83
stub out test jobs
ee1a2ad
remove rebuild
1fc807b
Add make release target
acee5d5
Revert "Add make release target"
08b6d82
import ghcr into test
d0938ba
remove ghcr workflow
9abf42c
re-intro standard CI
97cf732
remove extra permissiosn
5750c0a
add tag check
08d168a
add release script
814d416
add release script
f5dc805
tweak script
0b22c62
shellcheck
ed2c141
ci: rename check-image-references job
6e05a50
Merge branch 'next' into another-try
alxndrsn c693163
use existing version
1fc0e68
Merge branch 'next' into another-try
alxndrsn 7e8f06a
Merge branch 'next' into another-try
be7bc45
fix release shebang
2e76aaf
remove ghcr workflow again
b985329
tag-release.sh: update to block running on `master` branch
db118eb
Add script compose-snapshots.sh
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
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| #!/bin/bash -eu | ||
| set -o pipefail | ||
|
|
||
| log() { echo "[release] $*"; } | ||
|
|
||
| log "Checking git branch..." | ||
| currentBranch="$(git rev-parse --abbrev-ref HEAD)" | ||
| if [[ "$currentBranch" != master ]]; then | ||
| log "!!!" | ||
| log "!!! Unexpected branch:" | ||
| log "!!! Expected: master" | ||
| log "!!! Actual: $currentBranch" | ||
| log "!!!" | ||
| exit 1 | ||
| fi | ||
| log " Git branch OK." | ||
|
|
||
| log "Checking for uncommitted changes..." | ||
| gitStatus="$(git status --porcelain)" | ||
| if [[ "$gitStatus" != "" ]]; then | ||
| log "!!!" | ||
| log "!!! Your working directory is dirty. Make sure you have committed all changes." | ||
| log "!!!" | ||
| exit 1 | ||
| fi | ||
| log " No uncommitted changes found." | ||
|
|
||
| log "Checking for divergence from upstream..." | ||
| upstream="$(git rev-parse --abbrev-ref '@{upstream}')" | ||
| remote="${upstream%%/*}" | ||
| log " Fetching from remote '$remote'..." | ||
| git fetch "$remote" | ||
| log " Comparing to $upstream..." | ||
| if ! git diff --exit-code "$upstream"..HEAD; then | ||
| log "!!!" | ||
| log "!!! Differences found between HEAD and tracking branch $upstream !!!" | ||
| log "!!!" | ||
| log "!!! Do you need to git push?" | ||
| log "!!!" | ||
| exit 1 | ||
| fi | ||
| log " HEAD seems to be in-line with upstream." | ||
|
|
||
| year="$(date +%Y)" | ||
| if git tag | grep "^v$year\."; then | ||
| lastMinor="$(git tag | grep "^v$year" | tail -n1 | cut -d'.' -f2)" | ||
| suggestedVersion="v$year.$((lastMinor+1)).0" | ||
| else | ||
| suggestedVersion="v$year.1.0" | ||
| fi | ||
| read -r -e \ | ||
| -p "[release] Version to release: " \ | ||
| -i "$suggestedVersion" newVersion | ||
| if ! [[ "$newVersion" = v*.*.* ]]; then | ||
| log "!!!" | ||
| log "!!! Version '$newVersion' does not match expected format." | ||
| log "!!!" | ||
| exit 1 | ||
| fi | ||
|
|
||
| log "Updating version numbers in docker-compose.yml ..." | ||
| tmpfile="$(mktemp)" | ||
| sed -E \ | ||
| -e "s_(image:\s+'.*/.*/central-nginx):.*'_\1:$newVersion'_" \ | ||
| -e "s_(image:\s+'.*/.*/central-service):.*'_\1:$newVersion'_" \ | ||
| docker-compose.yml > "$tmpfile" | ||
| mv "$tmpfile" docker-compose.yml | ||
|
|
||
| log "Committing changes to git..." | ||
| git add docker-compose.yml | ||
| git commit -m"Release version: $newVersion" | ||
| git tag "$newVersion" | ||
|
|
||
| log "Pushing release to git..." | ||
| git push && git push --tags | ||
|
|
||
| echo | ||
| log "Release complete. Check build progress at:" | ||
| log "" | ||
| log " https://github.com/getodk/central/actions" | ||
| echo |
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,7 @@ | ||
| services: | ||
| service: | ||
| build: | ||
| dockerfile: service.dockerfile | ||
| nginx: | ||
| build: | ||
| dockerfile: nginx.dockerfile |
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 |
|---|---|---|
|
|
@@ -3,6 +3,13 @@ set -o pipefail | |
|
|
||
| log() { echo >&2 "[$(basename "$0")] $*"; } | ||
|
|
||
| docker_compose() { | ||
| docker compose \ | ||
| --file docker-compose.yml \ | ||
| --file test/snapshots.docker-compose.yml \ | ||
| "$@" | ||
| } | ||
|
|
||
| tmp="$(mktemp)" | ||
|
|
||
| check_path() { | ||
|
|
@@ -13,7 +20,7 @@ check_path() { | |
| for (( i=0; ; ++i )); do | ||
| log "Checking response from $requestPath ..." | ||
| echo -e "GET $requestPath HTTP/1.0\r\nHost: local\r\n\r\n" | | ||
| docker compose exec --no-TTY nginx \ | ||
| docker_compose exec --no-TTY nginx \ | ||
| openssl s_client -quiet -connect 127.0.0.1:443 \ | ||
| >"$tmp" 2>&1 || true | ||
| if grep --silent --fixed-strings "$expected" "$tmp"; then | ||
|
|
@@ -43,10 +50,10 @@ [email protected]' > .env | |
| touch ./files/allow-postgres14-upgrade | ||
|
|
||
| log "Building docker containers..." | ||
| docker compose build | ||
| docker_compose build | ||
|
|
||
| log "Starting containers..." | ||
| docker compose up --detach | ||
| docker_compose up --detach | ||
|
|
||
| log "Verifying frontend..." | ||
| check_path 30 / 'ODK Central' | ||
|
|
@@ -57,7 +64,7 @@ check_path 2 /v1/projects '[]' | |
| log " Backend started OK." | ||
|
|
||
| log "Verifying pm2..." | ||
| docker compose exec service npx pm2 list | tee "$tmp" | ||
| docker_compose exec service npx pm2 list | tee "$tmp" | ||
| processCount="$(grep --count online "$tmp")" | ||
| if [[ "$processCount" != 4 ]]; then | ||
| log "!!! PM2 returned an unexpected count for online processes." | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.