forked from aptos-labs/aptos-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docker] Check that version matches tag before publishing release images
We currently dont check that the tag and the aptos-node cargo.toml version match This ensures that before publish we have to check the tag and version match only for release images Test Plan: wrote unittests and added a testing workflow made the script possibel to unittest
- Loading branch information
1 parent
bba6feb
commit f83e6c3
Showing
8 changed files
with
2,519 additions
and
128 deletions.
There are no files selected for viewing
This file contains 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,28 @@ | ||
name: Test Release Images | ||
on: | ||
pull_request: | ||
paths: | ||
- "docker/release-images.mjs" | ||
- "docker/__tests__/**" | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "docker/release-images.mjs" | ||
- "docker/__tests__/**" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-copy-images: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .node-version | ||
- uses: pnpm/action-setup@v2 | ||
- run: pnpm install | ||
- name: Test Release Images | ||
run: ./docker/test.sh |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,30 @@ | ||
#!/usr/bin/env -S pnpm test release-images.test.js | ||
|
||
import { assertTagMatchesSourceVersion, getImageReleaseGroupByImageTagPrefix, isReleaseImage } from '../release-images.mjs'; | ||
|
||
describe('releaseImages', () => { | ||
it('gets aptos-node as the default image group', () => { | ||
const prefix = 'image-banana'; | ||
const releaseGroup = getImageReleaseGroupByImageTagPrefix(prefix); | ||
expect(releaseGroup).toEqual('aptos-node'); | ||
}); | ||
it('gets indexer image group', () => { | ||
const prefix = 'aptos-indexer-grpc-vX.Y.Z'; | ||
const releaseGroup = getImageReleaseGroupByImageTagPrefix(prefix); | ||
expect(releaseGroup).toEqual('aptos-indexer-grpc'); | ||
}); | ||
it('gets aptos-node as the node image group', () => { | ||
const prefix = 'aptos-node-vX.Y.Z'; | ||
const releaseGroup = getImageReleaseGroupByImageTagPrefix(prefix); | ||
expect(releaseGroup).toEqual('aptos-node'); | ||
}); | ||
it('determines image is a release image', () => { | ||
expect(isReleaseImage("nightly-banana")).toEqual(false); | ||
expect(isReleaseImage("aptos-node-v1.2.3")).toEqual(true); | ||
}); | ||
it('asserts version match', () => { | ||
// toThrow apparently matches a prefix, so this works but it does actually test against the real config version | ||
// Which... hilariously means this would fail if the version was ever 0.0.0 | ||
expect(() => assertTagMatchesSourceVersion("aptos-node-v0.0.0")).toThrow("image tag does not match cargo version: aptos-node-v0.0.0"); | ||
}); | ||
}); |
Oops, something went wrong.