Skip to content

postgres-upgrade: halt if any stage of upgrade fails#890

Merged
alxndrsn merged 7 commits intogetodk:nextfrom
alxndrsn:test-dockerfiles
Feb 13, 2025
Merged

postgres-upgrade: halt if any stage of upgrade fails#890
alxndrsn merged 7 commits intogetodk:nextfrom
alxndrsn:test-dockerfiles

Conversation

@alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Feb 11, 2025

Noted while working on #882: files/postgres/upgrade-postgres.sh is not actually run with /bin/bash -eu as its shebang declares, but with /bin/sh.

This PR

  1. fixes the shell used for upgrade-postgres.sh
  2. introduces a test which would have detected this issue, and should prevent similar issues in future
  3. fixes use of deprecated dockerfile syntax detected by the new test
  4. pulls shellcheck invocation into a script file to allow easier use locally, and possible future extension

Docker build checks

Currently in beta, "docker build checks" are a best-practice linter for dockerfiles.

See: https://docs.docker.com/build/checks/#check-a-build-without-building

Dockerfile fixes


Related: #342


What has been done to verify that this works as intended?

CI

Why is this the best possible solution? Were any other approaches considered?

Docker build checks are built-in to docker. However, they're in beta, so there is a chance they could be changed or dropped in future. This PR could be restricted to simply changing postgres-upgrade.dockerfile.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Should not affect users.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No.

Before submitting this PR, please make sure you have:

  • branched off and targeted the next branch OR only changed documentation/infrastructure (master is stable and used in production)
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

@alxndrsn alxndrsn changed the title ci: check dockerfiles postgres-upgrade: fail if any stage of upgrade failed Feb 11, 2025
@alxndrsn alxndrsn changed the title postgres-upgrade: fail if any stage of upgrade failed postgres-upgrade: halt if any stage of upgrade fails Feb 11, 2025
@alxndrsn alxndrsn marked this pull request as ready for review February 11, 2025 12:28
@alxndrsn alxndrsn merged commit c0c25d4 into getodk:next Feb 13, 2025
3 checks passed
@alxndrsn alxndrsn deleted the test-dockerfiles branch February 13, 2025 07:17
yanokwa pushed a commit to yanokwa/odk-central that referenced this pull request Jun 11, 2025
Noted while working on getodk#882: `files/postgres/upgrade-postgres.sh` is not actually run with `/bin/bash -eu` as its shebang declares, but with `/bin/sh`.

-----

This commit

1. fixes the shell used for `upgrade-postgres.sh`
2. introduces a test which would have detected this issue, and should prevent similar issues in future
3. fixes use of deprecated dockerfile syntax detected by the new test
4. pulls `shellcheck` invocation into a script file to allow easier use locally, and possible future extension

-----

Docker build checks

Currently in beta, "docker build checks" are best-practice lint checks for dockerfiles.

See: https://docs.docker.com/build/checks/#check-a-build-without-building

-----

Dockerfile fixes

* `postgres-upgrade.dockerfile`: https://docs.docker.com/reference/build-checks/json-args-recommended/
* `postgres14.dockerfile`: https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/

-----

Related: getodk#342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants