Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DROOLS-7638]"docker system prune -f" fails in GHA #82

Merged

Conversation

tkobayas
Copy link

@tkobayas tkobayas force-pushed the DROOLS-7638-docker-system-prune branch 2 times, most recently from 18e8834 to 32066d4 Compare October 17, 2024 04:40
@tkobayas
Copy link
Author

Hmm,

      current: |
        bash -c "if docker system df > /dev/null 2>&1; then docker system prune -f; else echo 'Prune operation already in progress. Skipping this command.'; fi"

resulted in

2024-10-17T05:15:51.3981823Z [command]/usr/bin/bash -c if docker system df > /dev/null 2>&1; then docker system prune -f; else echo 'Prune operation already in progress. Skipping this command.'; fi
2024-10-17T05:15:51.4689072Z Error response from daemon: a prune operation is already running

It means docker system df is not effective to check the lock.

We may just proceed when we hit "a prune operation is already running".

@tkobayas tkobayas force-pushed the DROOLS-7638-docker-system-prune branch from 32066d4 to cf37b33 Compare October 17, 2024 05:30
@tkobayas
Copy link
Author

Okay. In Kogito Downstream / kogito-apps,

2024-10-17T06:22:00.8930991Z [command]/usr/bin/bash -c docker system prune -f 2>&1 | grep -q 'a prune operation is already running' && echo 'Prune operation already in progress. Skipping this command.' || true
2024-10-17T06:22:00.9090193Z Prune operation already in progress. Skipping this command.

GHA skips docker system prune -f in this case. I think it's a safe workaround, although we haven't identified why kogito-apps hits this issue.

@@ -25,7 +25,7 @@ default:
mvn clean install -Dquickly ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_UPSTREAM }}
after:
current: |
docker system prune -f
bash -c "docker system prune -f 2>&1 | grep -q 'a prune operation is already running' && echo 'Prune operation already in progress. Skipping this command.' || true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better to use different command than prune?

see this for instance docker/for-mac#2501
As recommended docker rmi $(docker images -f "dangling=true"-q) is logging the progress

@tkobayas tkobayas force-pushed the DROOLS-7638-docker-system-prune branch 5 times, most recently from 0a57959 to 7c94a45 Compare October 18, 2024 04:50
- Use docker rmi rather than prune because prune could be faulty and slow
@tkobayas tkobayas force-pushed the DROOLS-7638-docker-system-prune branch from 7c94a45 to 6967ba9 Compare October 18, 2024 05:58
@@ -25,7 +25,7 @@ default:
mvn clean install -Dquickly ${{ env.BUILD_MVN_OPTS }} ${{ env.BUILD_MVN_OPTS_UPSTREAM }}
after:
current: |
docker system prune -f
bash -c "if [ -n \"$(docker images -f dangling=true -q)\" ]; then docker rmi $(docker images -f dangling=true -q); else echo 'No dangling images to remove.'; fi"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used if block because docker rmi fails if there is no dangling images.

@tkobayas tkobayas marked this pull request as ready for review October 18, 2024 07:16
@tkobayas
Copy link
Author

tkobayas commented Oct 18, 2024

@mareknovotny Thanks, replaced with docker rmi $(docker images -f dangling=true -q).

2024-10-18T06:36:13.1706053Z [command]/usr/bin/bash -c if [ -n "$(docker images -f dangling=true -q)" ]; then docker rmi $(docker images -f dangling=true -q); else echo 'No dangling images to remove.'; fi
2024-10-18T06:36:13.1893638Z No dangling images to remove

Actually, there is no dangling images in this case. But I think it's good to go.

@tkobayas tkobayas changed the title [DO-NOT-MERGE][DROOLS-7638]"docker system prune -f" fails in GHA [DROOLS-7638]"docker system prune -f" fails in GHA Oct 18, 2024
@tkobayas
Copy link
Author

@rgdoliveira @mareknovotny Please review, thanks!

@tkobayas tkobayas merged commit 70f8af9 into kiegroup:9.101.x-prod Oct 21, 2024
10 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants