Skip to content
Open
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
16 changes: 13 additions & 3 deletions images/calico-go-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
ARG TARGETARCH=${TARGETARCH}

# Bump to pick up a change to the Argo CI helper scripts copied in near the end.
ARG CI_SCRIPTS_VERSION=v1
FROM calico/ci-scripts:${CI_SCRIPTS_VERSION} AS ci-scripts

FROM almalinux:9 AS builder

ARG TARGETARCH
Expand Down Expand Up @@ -50,6 +54,7 @@ RUN set -eux; \
pcre-devel \
pigz \
pkg-config \
sudo \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need sudo now?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checkout script uses sudo to chmod on the checked out directory to give broader write permissions
https://github.com/tigera/cc-utils/blob/tsla-11651-pre/argoci-images/common-scripts/checkout#L34

we do support no-sudo as an option so if you would prefer I can remove this

wget \
xz \
zip
Expand Down Expand Up @@ -306,9 +311,14 @@ COPY bin/semvalidator-${TARGETARCH} /usr/local/bin/semvalidator
# Install Argo CI helper scripts so this image can serve as the base for Argo
# workflows, which have no pre-checkout step. Semaphore runners do their own
# checkout and ignore these.
COPY scripts/checkout.sh /usr/local/bin/checkout
COPY scripts/setup-github-ssh.sh /usr/local/bin/setup-github-ssh
COPY scripts/create-local-secret.sh /usr/local/bin/create-local-secret
COPY --from=ci-scripts / /usr/local/bin/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can copy from /from-script-name to /usr/local/bin/to-script-name so no need to run ln later.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ln is to allow the script to be called with either name
The scripts that were removed are using kebab-case for the names whereas ArgoCI uses camelCase for the script names
I added the ln so that it doesn't break any existing CI that might be using the kebab-case method calls

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. It is better to do an explicit copy from the source to the target (like the lines you removed), rather than all files under / to /usr/local/bin. We don't want files or folders to get overwritten without realizing it. Being explicit will also make the build fail loudly if the source file doesn't exist.


# Some callers use the kebab-case spellings; alias them so there is one
# implementation rather than two that can disagree.
RUN set -eux; \
cd /usr/local/bin; \
ln -sf setupGithubSSH setup-github-ssh; \
ln -sf createLocalSecret create-local-secret

COPY entrypoint.sh /usr/local/bin/entrypoint.sh

Expand Down
17 changes: 0 additions & 17 deletions images/calico-go-build/scripts/checkout.sh

This file was deleted.

15 changes: 0 additions & 15 deletions images/calico-go-build/scripts/create-local-secret.sh

This file was deleted.

12 changes: 0 additions & 12 deletions images/calico-go-build/scripts/setup-github-ssh.sh

This file was deleted.