Skip to content

Commit

Permalink
Makefile,ci.sh: use versioned images
Browse files Browse the repository at this point in the history
Get a voom style git hash of the impl Dockerfile and use that as the
testing docker image version (rather than blank which implies "latest").
  • Loading branch information
kanaka committed Aug 1, 2024
1 parent 96e6d9c commit 78d6dab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix-linux) }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Need full history for voom like versions
- name: Build
run: |
export ${{ matrix.IMPL }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ STEP_TEST_FILES = $(strip $(wildcard \

# DOCKERIZE utility functions
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
impl_to_image = kanaka/mal-test-$(call lc,$(1))
impl_to_image = kanaka/mal-test-$(call lc,$(1)):$(shell ./voom-like-version.sh impls/$(1)/Dockerfile)

actual_impl = $(if $(filter mal,$(1)),$(patsubst %-mal,%,$(MAL_IMPL)),$(1))

Expand Down
3 changes: 2 additions & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ echo "TEST_OPTS: ${TEST_OPTS}"
# the Travis/Github Actions image/tools directly.
if [ -z "${NO_DOCKER}" ]; then
img_impl=$(echo "${MAL_IMPL:-${IMPL}}" | tr '[:upper:]' '[:lower:]')
img_ver=$(./voom-like-version.sh impls/${img_impl}/Dockerfile)
# We could just use make DOCKERIZE=1 instead but that does add
# non-trivial startup overhead for each step.
MAKE="docker run -i -u $(id -u) -v `pwd`:/mal kanaka/mal-test-${img_impl%%-mal} ${MAKE}"
MAKE="docker run -i -u $(id -u) -v `pwd`:/mal kanaka/mal-test-${img_impl%%-mal}:${img_ver} ${MAKE}"
fi

case "${ACTION}" in
Expand Down
3 changes: 3 additions & 0 deletions voom-like-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

echo $(TZ=UTC git log -1 --pretty=%ad-g%h --date=format-local:"%Y%m%d_%H%M%S" -- "$@")$(test -z "$(git status --short -- "$@")" || echo _DIRTY)

0 comments on commit 78d6dab

Please sign in to comment.