Skip to content

Commit

Permalink
Use the localhost/ "prefix" to be able to use podman-built images on …
Browse files Browse the repository at this point in the history
…docker easily.

Workaround for containers/buildah#1034.
  • Loading branch information
adelton committed Sep 7, 2021
1 parent 020c525 commit f02de21
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build image
run: ${{ matrix.docker }} build -t local/freeipa-server:${{ matrix.os }} -f Dockerfile.${{ matrix.os }} .
run: ${{ matrix.docker }} build -t localhost/freeipa-server:${{ matrix.os }} -f Dockerfile.${{ matrix.os }} .
- name: File issue if building image failed
if: ${{ failure() && github.event_name == 'schedule' }}
run: |
Expand All @@ -44,9 +44,9 @@ jobs:
- name: Create directory for artifacts
run: mkdir freeipa-server-${{ matrix.os }}
- name: Save image
run: ${{ matrix.docker }} save local/freeipa-server:${{ matrix.os }} | gzip > freeipa-server-${{ matrix.os }}/freeipa-server-${{ matrix.os }}.tar.gz
run: ${{ matrix.docker }} save localhost/freeipa-server:${{ matrix.os }} | gzip > freeipa-server-${{ matrix.os }}/freeipa-server-${{ matrix.os }}.tar.gz
- name: Get FreeIPA version
run: ${{ matrix.docker }} run --rm --entrypoint rpm local/freeipa-server:${{ matrix.os }} -qf --qf '%{version}\n' /usr/sbin/ipa-server-install > freeipa-server-${{ matrix.os }}/freeipa-server-${{ matrix.os }}.version
run: ${{ matrix.docker }} run --rm --entrypoint rpm localhost/freeipa-server:${{ matrix.os }} -qf --qf '%{version}\n' /usr/sbin/ipa-server-install > freeipa-server-${{ matrix.os }}/freeipa-server-${{ matrix.os }}.version
- uses: actions/upload-artifact@v2
with:
name: freeipa-server-${{ matrix.os }}
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
if: ${{ matrix.protected_regular == 'unset' }}
run: sudo sysctl fs.protected_regular=0
- name: Run master and replica
run: readonly=${{ matrix.readonly }} ca=${{ matrix.ca }} seccomp=${{ matrix.seccomp }} replica=${{ matrix.replica }} tests/run-master-and-replica.sh local/freeipa-server:${{ matrix.os }}
run: readonly=${{ matrix.readonly }} ca=${{ matrix.ca }} seccomp=${{ matrix.seccomp }} replica=${{ matrix.replica }} tests/run-master-and-replica.sh localhost/freeipa-server:${{ matrix.os }}
- name: Run partial tests
if: ${{ failure() }}
run: tests/run-partial-tests.sh Dockerfile.${{ matrix.os }}
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Load image
run: gunzip < freeipa-server-${{ matrix.os }}.tar.gz | sudo podman load
- name: Run master and replica
run: docker='sudo podman' tests/run-master-and-replica.sh local/freeipa-server:${{ matrix.os }}
run: docker='sudo podman' tests/run-master-and-replica.sh localhost/freeipa-server:${{ matrix.os }}
- name: Run partial tests
if: ${{ failure() }}
run: docker='sudo podman' tests/run-partial-tests.sh Dockerfile.${{ matrix.os }}
Expand All @@ -123,7 +123,7 @@ jobs:
run: ssh-keygen -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys && chmod 400 ~/.ssh/authorized_keys && chmod o-w ~
- name: Run master
shell: ssh -o StrictHostKeyChecking=no localhost bash {0}
run: cd ${{ github.workspace }} && docker=podman tests/run-master-and-replica.sh local/freeipa-server:${{ matrix.os }} && podman pod ls -q | xargs podman pod rm -f
run: cd ${{ github.workspace }} && docker=podman tests/run-master-and-replica.sh localhost/freeipa-server:${{ matrix.os }} && podman pod ls -q | xargs podman pod rm -f
- name: Run partial tests
if: ${{ failure() }}
shell: ssh localhost bash {0}
Expand All @@ -149,7 +149,7 @@ jobs:
- name: Populate volume with data
run: docker volume create loaded-data && docker create --name loaded-data -v loaded-data:/data:z docker.io/freeipa/freeipa-server:data-${{ matrix.data-from }} noop && mkdir /tmp/freeipa-data && docker run --volumes-from loaded-data -v /tmp/freeipa-data:/data-out:z --rm docker.io/library/busybox sh -c 'cd /data && cp -a . /data-out'
- name: Run master and replica
run: VOLUME=/tmp/freeipa-data replica=none tests/run-master-and-replica.sh local/freeipa-server:${{ matrix.os }}
run: VOLUME=/tmp/freeipa-data replica=none tests/run-master-and-replica.sh localhost/freeipa-server:${{ matrix.os }}

test-k3s:
name: Run with K3s
Expand All @@ -167,7 +167,7 @@ jobs:
- name: Unzip the image
run: gunzip freeipa-server-${{ matrix.os }}.tar.gz
- name: Run K3s and master in it
run: tests/run-master-in-k3s.sh local/freeipa-server:${{ matrix.os }} freeipa-server-${{ matrix.os }}.tar
run: tests/run-master-in-k3s.sh localhost/freeipa-server:${{ matrix.os }} freeipa-server-${{ matrix.os }}.tar

push-after-success:
name: Push images to registries
Expand Down
2 changes: 1 addition & 1 deletion tests/freeipa-k3s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ spec:
restartPolicy: Never
containers:
- name: freeipa-server
image: local/freeipa-server:latest
image: localhost/freeipa-server:latest
imagePullPolicy: Never
volumeMounts:
- name: freeipa-server-data
Expand Down
10 changes: 5 additions & 5 deletions tests/run-partial-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ while [ "$START" -lt "$END" ] ; do
echo "# This line is commented out to match line count" > "$DOCKERFILE.part"
sed -n "$SED_TO_NEXT_TEST" "$DOCKERFILE" >> "$DOCKERFILE.part"
else
echo "FROM local/freeipa-server-test:$SUFFIX" > "$DOCKERFILE.part"
echo "FROM localhost/freeipa-server-test:$SUFFIX" > "$DOCKERFILE.part"
sed -n "1,${START}{s/^/## /;p;d};$SED_TO_NEXT_TEST" "$DOCKERFILE" >> "$DOCKERFILE.part"
fi

TEST_SCRIPT=$( sed -n '$s/^# test:\s*//;T;s/\( \|$\)/ 'freeipa-server-container-$SUFFIX' /;p' "$DOCKERFILE.part" )
if [ -n "$TEST_SCRIPT" ] ; then
$docker build -t "local/freeipa-server-test:$SUFFIX" -f "$DOCKERFILE.part" .
echo "FROM local/freeipa-server-test:$SUFFIX" > "$DOCKERFILE.part.addons"
$docker build -t "localhost/freeipa-server-test:$SUFFIX" -f "$DOCKERFILE.part" .
echo "FROM localhost/freeipa-server-test:$SUFFIX" > "$DOCKERFILE.part.addons"
sed -n 's/# test-addon:\s*//;T;p' "$DOCKERFILE.part" >> "$DOCKERFILE.part.addons"
$docker build -t "local/freeipa-server-test-addons:$SUFFIX" -f "$DOCKERFILE.part.addons" .
$docker build -t "localhost/freeipa-server-test-addons:$SUFFIX" -f "$DOCKERFILE.part.addons" .
$docker rm -f freeipa-server-container-$SUFFIX > /dev/null 2>&1 || :
# Starting systemd container
run_and_wait_for local/freeipa-server-test-addons:$SUFFIX freeipa-server-container-$SUFFIX
run_and_wait_for localhost/freeipa-server-test-addons:$SUFFIX freeipa-server-container-$SUFFIX
echo Executing $DIR/$TEST_SCRIPT
$DIR/$TEST_SCRIPT
else
Expand Down

0 comments on commit f02de21

Please sign in to comment.