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

docker image is broken (git-ask-pass - java.io.IOException: Cannot run program: error=8, Exec format error) #1374

Closed
tyrcho opened this issue Mar 25, 2020 · 10 comments · Fixed by #1375

Comments

@tyrcho
Copy link
Contributor

tyrcho commented Mar 25, 2020

Hi,

It seems that something changed in the last day in the docker image for scala-steward. Now all my jobs fail with this error : java.io.IOException: Cannot run program "/builds/tyrcho/michel-steward/pass.sh": error=8, Exec format error

Complete job log : https://gitlab.com/tyrcho/michel-steward/-/jobs/484488462

Here is how I start the job:
https://gitlab.com/tyrcho/michel-steward/-/blob/master/steward.sh

/opt/docker/bin/scala-steward \
    -DROOT_LOG_LEVEL=INFO \
    -DLOG_LEVEL=INFO \
    --disable-sandbox \
    --do-not-fork \
    --workspace "$(pwd)/workspace/" \
    --repos-file "$(pwd)/$REPOS_FILE" \
    --git-ask-pass "$(pwd)/pass.sh" \
    --git-author-name "Scala Steward" \
    --git-author-email "steward@scala.com" \
    --vcs-type "gitlab" \
    --vcs-api-host "https://gitlab.com/api/v4/" \
    --vcs-login "tyrcho"

I did not change anything in my repos since weeks.

I also noticed that the docker base image must have changed recently, it had gpg before and now I have to install it (this is OK).

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 25, 2020

I tried to run it myself from a docker container and I reproduce exactly the same issue.
The file pass.sh can be executed.

@fthomas
Copy link
Member

fthomas commented Mar 25, 2020

The Docker image was recently changed in #1370. My guess is that Git is now missing in the image. It was previously available without installing it explicitly and it now needs to be added explicitly to the image.

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 26, 2020

Hi @fthomas thanks for having a look. I tried installing git but it does not change anything:

bash-4.4# apk add git
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/6) Installing nghttp2-libs (1.35.1-r1)
(2/6) Installing libssh2 (1.9.0-r1)
(3/6) Installing libcurl (7.64.0-r3)
(4/6) Installing expat (2.2.8-r0)
(5/6) Installing pcre2 (10.32-r1)
(6/6) Installing git (2.20.2-r0)
Executing busybox-1.29.3-r10.trigger
OK: 119 MiB in 79 packages
bash-4.4# ./steward.sh repos-colisweb-opensource.md
+ REPOS_FILE=repos-colisweb-opensource.md
++ pwd
++ pwd
++ pwd
+ /opt/docker/bin/scala-steward -DROOT_LOG_LEVEL=INFO -DLOG_LEVEL=INFO --disable-sandbox --process-timeout 30min --do-not-fork --env-var SBT_OPTS=-XX:MaxMetaspaceSize=512m --workspace /app/workspace/ --repos-file /app/repos-colisweb-opensource.md --git-ask-pass /app/pass-colisweb.sh --git-author-name 'Scala Steward' --git-author-email gitlab@colisweb.com --vcs-type gitlab --vcs-api-host https://gitlab.com/api/v4/ --vcs-login gitlab.ci1
java.io.IOException: Cannot run program "/app/pass-colisweb.sh": error=8, Exec format error
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
bash-4.4# /app/pass-colisweb.sh
**hidden token**

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 26, 2020

found the solution !

I've added a shebang on top on my pass.sh file #!/bin/bash and now it works. This SO hinted me the right way: https://stackoverflow.com/questions/27606653/oserror-errno-8-exec-format-error

This might be something you'd want to document.

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 26, 2020

damn, I was too quick :( now I see it's missing sbt ...

I'm not so sure moving to alpine was a great idea ... we are going to miss java, scala, sbt ...

why not start from this image ? https://hub.docker.com/layers/hseeberger/scala-sbt/11.0.6_1.3.8_2.12.10/images/sha256-6516c340e90986b7a7ab0a75eee81ebff024ee7156e8b180aa50f95fe50a9495?context=explore

It's about 500MB

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 26, 2020

this dockerfile seems also to be a good start https://gist.github.com/gyndav/c8d65b59793566ee73ed2aa25aa10497

@tyrcho tyrcho changed the title git-ask-pass - java.io.IOException: Cannot run program: error=8, Exec format error docker image is broken (git-ask-pass - java.io.IOException: Cannot run program: error=8, Exec format error) Mar 26, 2020
@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 26, 2020

@fthomas I reverted my Gitlab CI jobs to use a previous version of scala-steward docker image (published 6 days ago).

How would you like to proceed fixing the docker image ? Starting from an existing one like hseeberger/scala-sbt:11.0.6_1.3.8_2.12.10 or controlling in this project how it is built (like we started discussing in #1375) ?

If you need my help with the construction of the image tell me, that's something we do regularly at my work...

@fthomas
Copy link
Member

fthomas commented Mar 27, 2020

I would prefer controlling the image here so that it only contains the things that are required by Scala Steward. Any help with the Docker image is much appreciated!

@gkocur
Copy link
Contributor

gkocur commented Mar 27, 2020

The problem with the alpine image is sbt bash script expect the sbt-launch.jar in the same dir, so the approach with creating hard link in /usr/bin won't work.
Here is a PR which fixes it: #1379

@tyrcho
Copy link
Contributor Author

tyrcho commented Mar 27, 2020

thanks a lot @gkocur and @fthomas !

I tested the latest docker image, and with the shebang fix (#1375) it is now running fine => https://gitlab.com/tyrcho/michel-steward/-/jobs/488827090

I think we can merge #1375 which will completely close this issue, as far as I'm concerned.

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 a pull request may close this issue.

3 participants