Aws-codebuild-docker-images: Building amazonlinux2-x86_64-standard:3.0 fails on step 8/102: geckodriver

Created on 30 Jul 2020  路  11Comments  路  Source: aws/aws-codebuild-docker-images

I am attempting to build amazonlinux2-x86_64-standard:3.0 locally on Mac OS 10.15.6 using the latest commit from this repo but it is currently failing at step 8/102 installing geckodriver.

commit ad19b4181acda6276abde2864b4944869768305e (HEAD -> master, origin/master, origin/HEAD)

$ docker --version Docker version 19.03.12, build 48a66213fe

`Step 8/102 : RUN set -ex && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt && rm /tmp/geckodriver-latest-linux64.tar.gz && chmod 755 /opt/geckodriver && ln -s /opt/geckodriver /usr/bin/geckodriver && geckodriver --version
---> Running in d482d8362428

gzip: stdin: decompression OK, trailing garbage ignored
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The command '/bin/sh -c set -ex && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt && rm /tmp/geckodriver-latest-linux64.tar.gz && chmod 755 /opt/geckodriver && ln -s /opt/geckodriver /usr/bin/geckodriver && geckodriver --version' returned a non-zero code: 2`

bug

Most helpful comment

Seems to have also worked for Ubuntu standard:4.0 @tomoyat1 Thanks!

Replace L75 with:
&& curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")) | select(.browser_download_url | contains("asc") | not).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - \

All 11 comments

How does AWS expect us to locally build with this Dockerfile problem?

It's bigger than just one Dockerfile. aws/codebuild/standard:4.0 fails when I build it with Docker version 19.03.6-ce, build 369ce74 on the AMI Amazon Linux AMI 2018.03

docker build -t aws/codebuild/standard:4.0 .
Step 7/98 : RUN set -ex     && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi -     && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt     && rm /tmp/geckodriver-latest-linux64.tar.gz     && chmod 755 /opt/geckodriver     && ln -s /opt/geckodriver /usr/bin/geckodriver     && geckodriver --version
 ---> Running in e7f3f5758dc0
+ curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest
+ jq -r .assets[] | select(.browser_download_url | contains("linux64")).browser_download_url
+ wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi -
+ tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt

gzip: stdin: decompression OK, trailing garbage ignored
tar: Child returned status 2
tar: Error is not recoverable: exiting now
The command '/bin/sh -c set -ex     && curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi -     && tar -xzf /tmp/geckodriver-latest-linux64.tar.gz -C /opt     && rm /tmp/geckodriver-latest-linux64.tar.gz     && chmod 755 /opt/geckodriver     && ln -s /opt/geckodriver /usr/bin/geckodriver     && geckodriver --version' returned a non-zero code: 2

Maybe I can skip it.

The issue is at least present in previous commits going back 1 or 2 commits.
Also had the same issue attempting to build the Ubuntu standard:4.0 image and the Amazon Linux 2 standard:2.0 image.

Will opt to skip the problematic step for the time being as I don't need the geckodriver.

I ran the problematic steps locally and didn't have any issue pulling down the geckodriver and extracting it.

Also experiencing the same issue on Ubuntu standard:4.0/3.0 image and the Amazon Linux 2 standard:3.0 image

% curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")).browser_download_url'
https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz
https://github.com/mozilla/geckodriver/releases/download/v0.27.0/geckodriver-v0.27.0-linux64.tar.gz.asc

The jq command returns urls for both the tarball and its signature.
Resulting download is the tarball and the sig. concatenated, which tar does not recognize as a valid tarball.

Changing the jq invocation as below fixes the problem for me:
jq -r '.assets[] | select(.browser_download_url | contains("linux64")) | select(.browser_download_url | endswith(".tar.gz")).browser_download_url'

edit: use endswith() to explicitly state that file name should end with .tar.gz extension

Seems to have also worked for Ubuntu standard:4.0 @tomoyat1 Thanks!

Replace L75 with:
&& curl -s https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r '.assets[] | select(.browser_download_url | contains("linux64")) | select(.browser_download_url | contains("asc") | not).browser_download_url' | wget -O /tmp/geckodriver-latest-linux64.tar.gz -qi - \

I'll look into opening a PR with the fix later : )

What a terrible bug. @tomoyat1 Thanks for unblocking us all with a possible code patch. This bug simply must be no more than a few days old. Now I'm glad we're all friends on Github.

Thanks for reporting the issue. @tomoyat1 - Thanks for the workaround. If you like to submit a PR, please feel free to do so. Otherwise, we'll get this updated in the Dockerfile soon.

@subinataws Thanks for getting the fix in quickly. I couldn't get around to submitting the PR.

We can't be stopped from locally building! Thanks @subinataws it probably was no more than seven or eight test docker builds.

Was this page helpful?
0 / 5 - 0 ratings