Skip to content

Commit

Permalink
matrix
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri committed Apr 5, 2024
1 parent 792cb59 commit 335d4b9
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 20 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/tools-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ on:
push:
branches:
- tools-releases

env:
KUBERNETES_VERSION: 1.28.0
paths:
- 'hack/envtest/_matrix/*.yaml'

permissions:
contents: read
Expand Down Expand Up @@ -34,6 +33,29 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@2d756ea4c53f7f6b397767d8723b3a10a9f35bf2 # tag=v44.0.0
with:
files: |
hack/envtest/_matrix/*.yaml
- name: Setup package release version
id: release-version
run: |
if [[ ${{ steps.changed-files.outputs.all_changed_files_count }} != 1 ]]; then
echo "One Kubernetes patch version files should be changed to create a package, found ${{ steps.changed-files.outputs.all_changed_files_count }}"
exit 1
fi
for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do
export KUBERNETES_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.yaml)')
echo "KUBERNETES_VERSION=$KUBERNETES_VERSION" >> $GITHUB_ENV
GO_VERSION=$(yq eval '.go' $changed_file)
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV
ETCD_VERSION=$(yq eval '.etcd' $changed_file)
echo "ETCD_VERSION=$ETCD_VERSION" >> $GITHUB_ENV
done
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
Expand All @@ -46,9 +68,11 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./hack/tools/envtest/${{matrix.os}}/Dockerfile
file: ./hack/envtest/${{matrix.os}}/Dockerfile
build-args: |
GO_VERSION=${{env.GO_VERSION}}
KUBERNETES_VERSION=v${{env.KUBERNETES_VERSION}}
ETCD_VERSION=v${{env.ETCD_VERSION}}
OS=${{matrix.os}}
ARCH=${{matrix.arch}}
push: true
Expand Down
2 changes: 2 additions & 0 deletions hack/envtest/_matrix/v1.28.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go: 1.21
etcd: 3.5.13
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Build or fetch the following binaries for darwin and then host them in a tar.gz file in an alpine image
# - kube-apiserver (build)
# - kubectl (fetch)
# - etcd (fetch)

FROM golang:1.21 as builder
ARG GO_VERSION
FROM golang:${GO_VERSION} as builder

# Version and platform args.
ARG KUBERNETES_VERSION
ARG ETCD_VERSION=v3.5.13
ARG ETCD_VERSION
ARG OS=darwin
ARG ARCH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21 as builder
ARG GO_VERSION
FROM golang:${GO_VERSION} as builder

# Version and platform args.
ARG KUBERNETES_VERSION
ARG ETCD_VERSION=v3.5.13
ARG ETCD_VERSION
ARG OS=linux
ARG ARCH

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Build or fetch the following binaries for windows and then host them in a tar.gz file in an alpine image
# - kube-apiserver (build)
# - kubectl (fetch)
# - etcd (fetch)

FROM golang:1.21 as builder
ARG GO_VERSION
FROM golang:${GO_VERSION} as builder

# Version and platform args.
ARG KUBERNETES_VERSION
ARG ETCD_VERSION=v3.5.13
ARG ETCD_VERSION
ARG OS=windows
ARG ARCH

Expand Down

0 comments on commit 335d4b9

Please sign in to comment.