Skip to content

Commit b7f222f

Browse files
committed
Skip UPX compression when building images for linting
UPX compression takes a significant amount of time, and is pointless for throwaway images such as those built for linting jobs. Signed-off-by: Stephen Kitt <[email protected]>
1 parent bedc1f2 commit b7f222f

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

.github/workflows/linting.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Check out the repository
6363
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
6464
- name: Run golangci-lint
65-
run: make golangci-lint
65+
run: make golangci-lint UPX_LEVEL=-0
6666

6767
markdown-link-check:
6868
name: Markdown Links (modified files)
@@ -94,7 +94,7 @@ jobs:
9494
- name: Check out the repository
9595
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
9696
- name: Run packagedoc-lint
97-
run: make packagedoc-lint
97+
run: make packagedoc-lint UPX_LEVEL=-0
9898

9999
shellcheck:
100100
name: Shell

Makefile.images

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export REPO ?= quay.io/submariner
1212

1313
# Specific to `build_images.sh`
1414
export USE_CACHE ?= true
15+
export UPX_LEVEL
1516

1617
# Specific to `images`
1718
export OCIFILE PLATFORM

package/Dockerfile.shipyard-dapper-base

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ RUN dnf -y install --nodocs --setopt=install_weak_deps=False \
7272
dnf -y clean all && \
7373
rm -f /usr/bin/{dockerd,lto-dump} \
7474
/usr/libexec/gcc/x86_64-redhat-linux/10/lto1 && \
75-
find /usr/bin /usr/lib/golang /usr/libexec -type f -executable -newercc /proc -size +1M ! -name hyperkube \( -execdir upx ${UPX_LEVEL} {} \; -o -true \) && \
75+
[ "${UPX_LEVEL}" = -0 ] || find /usr/bin /usr/lib/golang /usr/libexec -type f -executable -newercc /proc -size +1M ! -name hyperkube \( -execdir upx ${UPX_LEVEL} {} \; -o -true \) && \
7676
ln -f /usr/bin/kubectl /usr/bin/hyperkube
7777

7878
COPY tools/go.mod /tools.mod

scripts/shared/build_image.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ fi
5656

5757
# Rebuild the image to update any changed layers and tag it back so it will be used.
5858
buildargs_flags=(--build-arg BUILDKIT_INLINE_CACHE=1 --build-arg "BASE_BRANCH=${BASE_BRANCH}" --build-arg "VERSION=${VERSION}")
59+
[[ -z "${UPX_LEVEL}" ]] || buildargs_flags+=(--build-arg "UPX_LEVEL=${UPX_LEVEL}")
5960
if [[ "${PLATFORM}" != "${default_platform}" ]] && docker buildx version > /dev/null 2>&1; then
6061
docker buildx use buildx_builder || docker buildx create --name buildx_builder --use
6162
docker buildx build "${output_flag}" -t "${local_image}" "${cache_flags[@]}" -f "${dockerfile}" --iidfile "${hashfile}" --platform "${PLATFORM}" "${buildargs_flags[@]}" .

0 commit comments

Comments
 (0)