Skip to content

Commit 0f87362

Browse files
Michael Vasseurvmcj
authored andcommitted
Repair the release
The repo was not properly quoted and the github.ref has another format with direct push. The push should be done without the tag after the image. Push resulting image to our DOMjudge GitHub container registry Alternative is to push to the own doing the PR, but they would be able to push another image to have the risk that in theory we test another PR than was used in the code from the PR. It seems to try to push the latest tag so make which tag pushed explicit.
1 parent 8944e11 commit 0f87362

6 files changed

+21
-15
lines changed

.github/workflows/build-contributor-container-PR.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
pr-contributor:
13-
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'main' }}
13+
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'refs/heads/main' }}
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
@@ -39,4 +39,5 @@ jobs:
3939
platforms: linux/amd64,linux/arm64
4040
push: true
4141
tags: ${{ steps.meta.outputs.tags }}
42-
labels: ${{ steps.meta.outputs.labels }}
42+
labels: ${{ steps.meta.outputs.labels }}
43+

.github/workflows/build-contributor-container-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
jobs:
1212
release-contributor:
13-
if: ${{ github.repository == 'domjudge/domjudge-packaging' && github.ref == 'main' }}
13+
if: ${{ github.repository == 'domjudge/domjudge-packaging' && github.ref == 'refs/heads/main' }}
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
@@ -33,3 +33,4 @@ jobs:
3333
platforms: linux/amd64,linux/arm64
3434
push: true
3535
tags: domjudge/domjudge-contributor:latest
36+

.github/workflows/build-domjudge-container-PR.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
jobs:
1313
pr-domjudge:
14-
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'main' }}
14+
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'refs/heads/main' }}
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
@@ -35,7 +35,7 @@ jobs:
3535
- name: Get an unique tag for when people PR often
3636
run: |
3737
GHR=${{ github.ref }}
38-
echo "PR_TAG=${GHR///}" >> $GITHUB_ENV
38+
echo "PR_TAG=${GHR///}${{ github.actor }}" >> $GITHUB_ENV
3939
4040
- name: If needed overwrite the DOMJUDGE_VERSION for this run
4141
run: |
@@ -62,20 +62,20 @@ jobs:
6262
- name: Build and push
6363
run: |
6464
for IMG in domserver judgehost default-judgehost-chroot; do
65-
IMAGE_NAME="${{ github.actor }}/$IMG:${{ env.DOMJUDGE_VERSION }}"
66-
docker image tag "$IMAGE_NAME" ghcr.io/${{ github.actor }}/$IMG:${{ env.PR_TAG }}
67-
docker image tag "$IMAGE_NAME" ${{ github.actor }}/$IMG:${{ env.PR_TAG }}
68-
docker push ghcr.io/${{ github.actor }}/$IMG:${{ env.PR_TAG }}
65+
IMAGE_NAME="${{ github.repository_owner }}/$IMG:${{ env.DOMJUDGE_VERSION }}"
66+
docker image tag "$IMAGE_NAME" ghcr.io/${{ github.repository_owner }}/$IMG:${{ env.PR_TAG }}
67+
docker image tag "$IMAGE_NAME" ${{ github.repository_owner }}/$IMG:${{ env.PR_TAG }}
68+
docker push ghcr.io/${{ github.repository_owner }}/$IMG:${{ env.PR_TAG }}
6969
done
7070
7171
- name: Check for wrong permisions
7272
run: |
7373
docker image list
7474
set -x
7575
for IMG in domserver judgehost; do
76-
files=$(docker run --rm --pull=never "${{ github.actor }}/$IMG:${{ env.PR_TAG }}" find / -xdev -perm -o+w ! -type l ! \( -type d -a -perm -+t \) ! -type c)
76+
files=$(docker run --rm --pull=never "${{ github.repository_owner }}/$IMG:${{ env.PR_TAG }}" find / -xdev -perm -o+w ! -type l ! \( -type d -a -perm -+t \) ! -type c)
7777
if [ -n "$files" ]; then
78-
echo "error: image ${{ github.actor }}/$IMG:${{ env.PR_TAG }} contains world-writable files:" >&2
78+
echo "error: image ${{ github.repository_owner }}/$IMG:${{ env.PR_TAG }} contains world-writable files:" >&2
7979
printf "%s\n" "$files" >&2
8080
exit 1
8181
fi

.github/workflows/build-domjudge-container-release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
release-domjudge:
15-
if: ${{ github.repository == 'domjudge/domjudge-packaging' && github.ref == 'main' }}
15+
if: ${{ github.repository == 'domjudge/domjudge-packaging' && github.ref == 'refs/heads/main' }}
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout
@@ -60,6 +60,7 @@ jobs:
6060
docker push domjudge/$IMG:${{ env.DOMJUDGE_VERSION }}
6161
if [ ${{ env.DOMJUDGE_LATEST }} = "true" ]; then
6262
docker tag domjudge/$IMG:${{ env.DOMJUDGE_VERSION }} domjudge/$IMG:latest
63-
docker push domjudge/$IMG:latest
63+
docker push domjudge/$IMG
6464
fi
6565
done
66+

.github/workflows/build-gitlab-container-PR.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
pr-gitlab:
11-
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'main' }}
11+
if: ${{ github.repository != 'domjudge/domjudge-packaging' || github.ref != 'refs/heads/main' }}
1212
name: PR GitLab image
1313
runs-on: ubuntu-latest
1414
permissions:
@@ -40,3 +40,4 @@ jobs:
4040
push: true
4141
tags: ${{ steps.meta.outputs.tags }}
4242
labels: ${{ steps.meta.outputs.labels }}
43+

.github/workflows/build-gitlab-container-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches:
66
- main
7+
78
jobs:
89
build-gitlab:
9-
if: ${{ github.repository == domjudge/domjudge-packaging && github.ref == main }}
10+
if: ${{ github.repository == 'domjudge/domjudge-packaging' && github.ref == 'refs/heads/main' }}
1011
name: Build GitLab image
1112
runs-on: ubuntu-latest
1213
permissions:
@@ -38,3 +39,4 @@ jobs:
3839
push: true
3940
tags: "domjudge/gitlabci:22.04"
4041
labels: ${{ steps.meta.outputs.labels }}
42+

0 commit comments

Comments
 (0)