-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
add test docker image to ghcr for dynamic VM testing #3775
Open
gdams
wants to merge
4
commits into
adoptium:master
Choose a base branch
from
gdams:test_image
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Docker | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/build_test_containers.yml | ||
- ansible/docker/test/Dockerfile* | ||
branches: | ||
- master | ||
push: | ||
paths: | ||
- .github/workflows/build_test_containers.yml | ||
- ansible/docker/test/Dockerfile* | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
generate-matrix: | ||
name: Generate Matrix | ||
runs-on: ubuntu-latest | ||
if: github.repository_owner == 'adoptium' | ||
outputs: | ||
matrix: ${{ steps.generate_matrix.outputs.matrix }} | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Get list of changed files in ansible/docker/test/Dockerfile* | ||
- name: Get list of changed Dockerfiles | ||
run: | | ||
if [ ${{ github.event_name }} == "push" ]; then | ||
changed_files=$(git diff --name-only HEAD~1 | grep ansible/docker/test/Dockerfile || true) | ||
else | ||
changed_files=$(git diff --name-only origin/master | grep ansible/docker/test/Dockerfile || true) | ||
fi | ||
echo $changed_files | ||
echo "changed_files=$changed_files" >> "$GITHUB_ENV" | ||
|
||
# Generate matrix | ||
- name: Generate matrix | ||
if: ${{ env.changed_files != '' }} | ||
id: generate_matrix | ||
run: | | ||
matrix=$(jq -n --arg files "${changed_files}" '{ | ||
"include": ($files | split("\n") | map(select(length > 0) | {dockerfile: .})) | ||
}') | ||
echo "matrix<<EOF"$'\n'"$matrix"$'\n'EOF >> $GITHUB_OUTPUT | ||
|
||
build-dockerfiles: | ||
name: Build Dockerfiles | ||
runs-on: ubuntu-latest | ||
needs: generate-matrix | ||
strategy: | ||
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}} | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
# Generate tag name based on the Dockerfile name | ||
- name: Set tag name | ||
run: echo "TAG_NAME=$(basename ${{ matrix.dockerfile }} | cut -d'.' -f2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | ||
|
||
- name: Build Dockerfile | ||
run: docker build -t ghcr.io/${{ github.repository_owner }}/test-containers:$TAG_NAME -f ${{ matrix.dockerfile }} . | ||
|
||
- name: Push Dockerfile to ghcr.io | ||
if: github.event_name == 'push' | ||
run: | | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | ||
docker push ghcr.io/${{ github.repository_owner }}/test-containers:$TAG_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG ant_version="1.10.15" | ||
ARG ant_512checksum="1de7facbc9874fa4e5a2f045d5c659f64e0b89318c1dbc8acc6aae4595c4ffaf90a7b1ffb57f958dd08d6e086d3fff07aa90e50c77342a0aa5c9b4c36bff03a9" | ||
ARG user="jenkins" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && apt-get install -qq -y \ | ||
curl \ | ||
fontconfig \ | ||
gcc \ | ||
git \ | ||
gnupg \ | ||
libxi6 \ | ||
libxrender1 \ | ||
libxtst6 \ | ||
locales \ | ||
make \ | ||
openjdk-17-jdk-headless \ | ||
openssh-client \ | ||
perl \ | ||
unzip \ | ||
wget \ | ||
xvfb \ | ||
zip | ||
|
||
# Install ant | ||
RUN wget -q -O /tmp/ant.zip "https://archive.apache.org/dist/ant/binaries/apache-ant-${ant_version}-bin.zip" | ||
RUN wget -q -O /tmp/ant-contrib.tar.gz https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.tar.gz | ||
RUN echo "$ant_512checksum /tmp/ant.zip" > /tmp/ant.sha512 | ||
RUN echo "0fd2771dca2b8b014a4cb3246715b32e20ad5d26754186d82eee781507a183d5e63064890b95eb27c091c93c1209528a0b18a6d7e6901899319492a7610e74ad /tmp/ant-contrib.tar.gz" >> /tmp/ant.sha512 | ||
RUN sha512sum --check --strict /tmp/ant.sha512 | ||
RUN ln -s /usr/local/apache-ant-${ant_version}/bin/ant /usr/bin/ant | ||
RUN unzip -q -d /usr/local /tmp/ant.zip | ||
RUN tar xpfz /tmp/ant-contrib.tar.gz -C /usr/local/apache-ant-${ant_version}/lib --strip-components=2 ant-contrib/lib/ant-contrib.jar | ||
|
||
# Clear up space | ||
RUN rm /tmp/ant.zip /tmp/ant-contrib.tar.gz | ||
|
||
RUN locale-gen en_US.utf8 | ||
|
||
RUN groupadd -g 1000 ${user} | ||
RUN useradd -c "Jenkins user" -d /home/${user} -u 1000 -g 1000 -m ${user} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To work with run-aqa, package 7zip is expected
sudo apt install p7zip-full p7zip-rar
https://github.com/adoptium/run-aqa/blob/master/src/runaqa.ts#L461. Which is also installed in github hosted runners https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.mdThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the discussion we had earlier today about whether we could simplify the dependencies by using, can you clarify why 7z is used instead? Looking at the comment above that line if I'm interpreting what is saying it's the same as yours get from "unzip -j".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the comment is the reason for 7z. And remember there were some unexpected behaviour on github hosted runners. I can't remember if I tried
unzip -j
before, but it's worth trying.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that works. Updated. adoptium/run-aqa#246