Skip to content

Commit

Permalink
Bump go to v1.21.6 and set a single source of truth
Browse files Browse the repository at this point in the history
  • Loading branch information
rikatz committed Jan 27, 2024
1 parent 02e6ebc commit 9f8663d
Show file tree
Hide file tree
Showing 24 changed files with 166 additions and 50 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ jobs:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV

- name: Set up Go
id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ env.GOLANG_VERSION }}
check-latest: true

- name: Run test
Expand All @@ -92,6 +95,8 @@ jobs:
name: Build
runs-on: ubuntu-latest
needs: changes
outputs:
golangversion: ${{ steps.golangversion.outputs.version }}
if: |
(needs.changes.outputs.go == 'true') || (needs.changes.outputs.charts == 'true') || (needs.changes.outputs.baseimage == 'true')
Expand All @@ -100,12 +105,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get go version
id: golangversion
run: |
echo "version=$(cat GOLANG_VERSION)" >> "$GITHUB_OUTPUT"
- name: Set up Go
id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ steps.golangversion.outputs.version }}
check-latest: true

- name: Set up QEMU
Expand Down Expand Up @@ -177,7 +187,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ needs.build.outputs.golangversion }}
check-latest: true

- name: Install Helm Unit Test Plugin
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV

- name: Set up Go
id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ env.GOLANG_VERSION }}
check-latest: true

- name: golangci-lint
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,19 @@ jobs:
(needs.changes.outputs.kube-webhook-certgen == 'true')
strategy:
matrix:
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, 1.29.0]
k8s: [v1.25.11, v1.26.6, v1.27.3, v1.28.0, v1.29.0]
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV

- name: Set up Go
id: go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ env.GOLANG_VERSION }}
check-latest: true
- name: image build
run: |
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ jobs:
with:
fetch-depth: 0

- name: Get go version
run: echo "GOLANG_VERSION=$(cat GOLANG_VERSION)" >> $GITHUB_ENV

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.5'
go-version: ${{ env.GOLANG_VERSION }}
check-latest: true

- name: Run GoReleaser Snapshot
Expand Down
1 change: 1 addition & 0 deletions GOLANG_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21.6
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ SHELL=/bin/bash -o pipefail -o errexit
# Use the 0.0 tag for testing, it shouldn't clobber any release builds
TAG ?= $(shell cat TAG)

GOLANG_VERSION ?= $(shell cat GOLANG_VERSION)

# e2e settings
# Allow limiting the scope of the e2e tests. By default run everything
FOCUS ?=
Expand Down Expand Up @@ -105,7 +107,7 @@ clean-chroot-image: ## Removes local image

.PHONY: build
build: ## Build ingress controller, debug tool and pre-stop hook.
build/run-in-docker.sh \
E2E_IMAGE=golang:$(GOLANG_VERSION)-alpine3.19 USE_SHELL=/bin/sh build/run-in-docker.sh \
MAC_OS=$(MAC_OS) \
PKG=$(PKG) \
ARCH=$(ARCH) \
Expand Down
25 changes: 8 additions & 17 deletions build/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# Copyright 2018 The Kubernetes Authors.
#
Expand All @@ -25,24 +25,15 @@ set -o errexit
set -o nounset
set -o pipefail

declare -a mandatory
mandatory=(
PKG
ARCH
COMMIT_SHA
REPO_INFO
TAG
)

for var in "${mandatory[@]}"; do
if [[ -z "${!var:-}" ]]; then
echo "Environment variable $var must be set"
exit 1
fi
done
if [ -z "$PKG" ] || [ -z "$ARCH" ] || [ -z "$COMMIT_SHA" ] || [ -z "$REPO_INFO" ] || [ -z "$TAG" ]; then
echo "Environments PKG, ARCH, COMMIT_SHA, REPO_INFO and TAG are required"
exit 1
fi


export CGO_ENABLED=0
export GOARCH=${ARCH}
export GOARCH="${ARCH}"

TARGETS_DIR="rootfs/bin/${ARCH}"
echo "Building targets for ${ARCH}, generated targets in ${TARGETS_DIR} directory."
Expand Down Expand Up @@ -75,4 +66,4 @@ ${GO_BUILD_CMD} \
-X ${PKG}/version.COMMIT=${COMMIT_SHA} \
-X ${PKG}/version.REPO=${REPO_INFO}" \
-buildvcs=false \
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"
-o "${TARGETS_DIR}/wait-shutdown" "${PKG}/cmd/waitshutdown"
11 changes: 3 additions & 8 deletions build/run-in-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,7 @@ fi

USER=${USER:-nobody}

#echo "..printing env & other vars to stdout"
#echo "HOSTNAME=`hostname`"
#uname -a
#env
#echo "DIND_ENABLED=$DOCKER_IN_DOCKER_ENABLED"
#echo "done..printing env & other vars to stdout"
USE_SHELL=${USE_SHELL:-"/bin/bash"}

if [[ "$DOCKER_IN_DOCKER_ENABLED" == "true" ]]; then
echo "..reached DIND check TRUE block, inside run-in-docker.sh"
Expand All @@ -100,5 +95,5 @@ else
args="$args -v /var/run/docker.sock:/var/run/docker.sock"
fi

${RUNTIME} run $args ${E2E_IMAGE} /bin/bash -c "${FLAGS}"
fi
${RUNTIME} run $args ${E2E_IMAGE} ${USE_SHELL} -c "${FLAGS}"
fi
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module k8s.io/ingress-nginx

go 1.21.5
go 1.21

require (
dario.cat/mergo v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.21.5
go 1.21

use (
.
Expand Down

0 comments on commit 9f8663d

Please sign in to comment.