diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 20433b6..9c8d611 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -19,7 +19,7 @@ jobs: - name: Set Matrix id: set-matrix run: | - echo "matrix=$(python3 bin/generate_matrix.py submittyrpi false ${{ github.event.before }} ${{ github.event.after }})" >> $GITHUB_OUTPUT + echo "matrix=$(python3 bin/generate_matrix.py submittyrpi ${{ github.event.before }} ${{ github.event.after }})" >> $GITHUB_OUTPUT - name: List Matrix run: | echo ${{ steps.set-matrix.outputs.matrix }} diff --git a/UPDATE_ALL b/UPDATE_ALL new file mode 100644 index 0000000..c992db8 --- /dev/null +++ b/UPDATE_ALL @@ -0,0 +1,7 @@ +Modifying this file will result in a build and push of all Dockerfiles + +Append a message below with the date and why all containers should be rebuilt + +----------------------------------------------------------------------------- + + diff --git a/bin/generate_matrix.py b/bin/generate_matrix.py index 41f3de4..e148b27 100644 --- a/bin/generate_matrix.py +++ b/bin/generate_matrix.py @@ -4,10 +4,10 @@ import sys from pathlib import Path -if len(sys.argv) > 5: +if len(sys.argv) > 4: print("Too many arguments!", file=sys.stderr) exit(1) -elif len(sys.argv) < 3: +elif len(sys.argv) < 2: print("Not enough arguments!", file=sys.argv) exit(1) @@ -16,18 +16,19 @@ exit(1) username = sys.argv[1] -build_all = sys.argv[2] to_build = [] -if build_all == "false": - hash_before = sys.argv[3] - hash_after = sys.argv[4] +hash_before = sys.argv[2] +hash_after = sys.argv[3] - # Get list of all changed files between 2 commits - output = subprocess.check_output(["git", "--no-pager", "diff", "--name-only", "--diff-filter=d", hash_before, hash_after]) - paths_updated = output.decode("utf-8").splitlines() +# Get list of all changed files between 2 commits +output = subprocess.check_output(["git", "--no-pager", "diff", "--name-only", "--diff-filter=d", hash_before, hash_after]) +paths_updated = output.decode("utf-8").splitlines() +build_all = "UPDATE_ALL" in paths_updated + +if not build_all: image_set = set() image_tag_set = set() @@ -89,7 +90,7 @@ } ) -elif build_all == "true": +else: images = os.listdir("dockerfiles") for image in images: path = Path("dockerfiles") / image