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

Add --describe command #71

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
run: ./build
- name: Test images
run: ./build --test
- name: Describe images
run: ./build --describe
- name: Push images
run: ./build --push
- name: Free Disk Space (Ubuntu) # Required by trivy to have enough space to scan full image
Expand Down
46 changes: 46 additions & 0 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,48 @@ function do_inner_test() {
fi
}

function do_describe() {
local image
image="$(image_name latest)"
docker run \
-u "$(id -u):$(id -g)" \
-w /work \
-v "$(pwd):/work" \
--rm \
"$image" \
/work/build --inner-describe
}

function do_inner_describe() {
echo "# Contents"
echo
echo "## Operating System"
echo
echo "* $(lsb_release --description --short)"
echo
echo "## Tools"
echo
echo "* bash $BASH_VERSION"
echo "* $(git --version)"
echo "* $(docker --version)"
echo "* $(docker compose version)"
echo "* $(yq --version)"
echo "* datadog-ci $(datadog-ci version)"
echo
echo "## JDKs"
echo
for variant in "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
variant_upper="${variant^^}"
env_upper="JAVA_${variant_upper}_HOME"
echo "* $env_upper"
echo '```'
"${!env_upper}/bin/java" -version
echo '```'
echo
done
echo
}

function do_push() {
local tag
for tag in base latest "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
Expand All @@ -168,6 +210,10 @@ elif [[ ${1} = "--test" ]]; then
elif [[ ${1} = "--inner-test" ]]; then
shift
do_inner_test "$@"
elif [[ ${1} = "--describe" ]]; then
do_describe
elif [[ ${1} = "--inner-describe" ]]; then
do_inner_describe
elif [[ ${1} = "--push" ]]; then
do_push
fi