Skip to content

Commit

Permalink
CI: only make install.tools when needed
Browse files Browse the repository at this point in the history
...and add a curl retry, and remove '-f' (fail) from curl
(it produces unhelpful logs).

Reason: CI flakes due to timeout fetching golangci-lint, which we
don't need most of the time.

A reminder that network fetches are a prime cause of flakes.

Fixes: #15892

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Sep 22, 2022
1 parent a49aa13 commit 80714bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -852,18 +852,26 @@ endif
install.tools: .install.ginkgo .install.golangci-lint ## Install needed tools
make -C test/tools

.PHONY: .install.goimports
.install.goimports:
$(MAKE) -C test/tools build/goimports

.PHONY: .install.ginkgo
.install.ginkgo:
$(GO) install $(BUILDFLAGS) ./vendor/github.com/onsi/ginkgo/ginkgo

.PHONY: .install.gitvalidation
.install.gitvalidation:
$(MAKE) -C test/tools build/git-validation

.PHONY: .install.golangci-lint
.install.golangci-lint:
VERSION=1.46.2 ./hack/install_golangci.sh

.PHONY: .install.md2man
.install.md2man:
if [ ! -x "$(GOMD2MAN)" ]; then \
make -C test/tools build/go-md2man ; \
$(MAKE) -C test/tools build/go-md2man ; \
fi

.PHONY: .install.pre-commit
Expand Down
18 changes: 6 additions & 12 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ case "$TEST_FLAVOR" in
validate)
dnf install -y $PACKAGE_DOWNLOAD_DIR/python3*.rpm
# For some reason, this is also needed for validation
make install.tools
make .install.pre-commit
make .install.pre-commit .install.gitvalidation
;;
automation) ;;
altbuild)
Expand All @@ -242,11 +241,9 @@ case "$TEST_FLAVOR" in
if [[ "$ALT_NAME" =~ RPM ]]; then
bigto dnf install -y glibc-minimal-langpack go-rpm-macros rpkg rpm-build shadow-utils-subid-devel
fi
make install.tools
;;
docker-py)
remove_packaged_podman_files
make install.tools
make install PREFIX=/usr ETCDIR=/etc

msg "Installing previously downloaded/cached packages"
Expand All @@ -258,16 +255,14 @@ case "$TEST_FLAVOR" in
;;
build) make clean ;;
unit)
make install.tools
make .install.ginkgo
;;
compose_v2)
make install.tools
dnf -y remove docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
;& # Continue with next item
apiv2)
make install.tools
msg "Installing previously downloaded/cached packages"
dnf install -y $PACKAGE_DOWNLOAD_DIR/python3*.rpm
virtualenv .venv/requests
Expand All @@ -276,16 +271,16 @@ case "$TEST_FLAVOR" in
pip install --requirement $GOSRC/test/apiv2/python/requirements.txt
;& # continue with next item
compose)
make install.tools
dnf install -y $PACKAGE_DOWNLOAD_DIR/podman-docker*
;& # continue with next item
int) ;&
int)
make .install.ginkgo
;&
sys) ;&
upgrade_test) ;&
bud) ;&
bindings) ;&
endpoint)
make install.tools
# Use existing host bits when testing is to happen inside a container
# since this script will run again in that environment.
# shellcheck disable=SC2154
Expand All @@ -309,7 +304,6 @@ case "$TEST_FLAVOR" in
machine)
dnf install -y $PACKAGE_DOWNLOAD_DIR/podman-gvproxy*
remove_packaged_podman_files
make install.tools
make install PREFIX=/usr ETCDIR=/etc
install_test_configs
;;
Expand Down Expand Up @@ -374,7 +368,7 @@ case "$TEST_FLAVOR" in
swagger) ;& # use next item
consistency)
make clean
make install.tools
make .install.goimports
;;
release) ;;
*) die_unknown TEST_FLAVOR
Expand Down
2 changes: 1 addition & 1 deletion hack/install_golangci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }

function install() {
echo "Installing golangci-lint v$VERSION into $BIN"
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$VERSION
curl -sSL --retry 5 https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$VERSION
}

# Undocumented behavior: golangci-lint installer requires $BINDIR in env,
Expand Down

0 comments on commit 80714bf

Please sign in to comment.