Skip to content

Commit c12c420

Browse files
authored
Add --describe command (#71)
Describes the contents of the built image in Markdown (e.g. for release notes).
1 parent e656995 commit c12c420

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
run: ./build
3838
- name: Test images
3939
run: ./build --test
40+
- name: Describe images
41+
run: ./build --describe
4042
- name: Push images
4143
run: ./build --push
4244
- name: Free Disk Space (Ubuntu) # Required by trivy to have enough space to scan full image

build

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,48 @@ function do_inner_test() {
152152
fi
153153
}
154154

155+
function do_describe() {
156+
local image
157+
image="$(image_name latest)"
158+
docker run \
159+
-u "$(id -u):$(id -g)" \
160+
-w /work \
161+
-v "$(pwd):/work" \
162+
--rm \
163+
"$image" \
164+
/work/build --inner-describe
165+
}
166+
167+
function do_inner_describe() {
168+
echo "# Contents"
169+
echo
170+
echo "## Operating System"
171+
echo
172+
echo "* $(lsb_release --description --short)"
173+
echo
174+
echo "## Tools"
175+
echo
176+
echo "* bash $BASH_VERSION"
177+
echo "* $(git --version)"
178+
echo "* $(docker --version)"
179+
echo "* $(docker compose version)"
180+
echo "* $(yq --version)"
181+
echo "* datadog-ci $(datadog-ci version)"
182+
echo
183+
echo "## JDKs"
184+
echo
185+
for variant in "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
186+
variant_upper="${variant^^}"
187+
env_upper="JAVA_${variant_upper}_HOME"
188+
echo "* $env_upper"
189+
echo '```'
190+
"${!env_upper}/bin/java" -version
191+
echo '```'
192+
echo
193+
done
194+
echo
195+
}
196+
155197
function do_push() {
156198
local tag
157199
for tag in base latest "${BASE_VARIANTS[@]}" "${VARIANTS[@]}"; do
@@ -168,6 +210,10 @@ elif [[ ${1} = "--test" ]]; then
168210
elif [[ ${1} = "--inner-test" ]]; then
169211
shift
170212
do_inner_test "$@"
213+
elif [[ ${1} = "--describe" ]]; then
214+
do_describe
215+
elif [[ ${1} = "--inner-describe" ]]; then
216+
do_inner_describe
171217
elif [[ ${1} = "--push" ]]; then
172218
do_push
173219
fi

0 commit comments

Comments
 (0)