Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#1143 from wzshiming/ci/version
Browse files Browse the repository at this point in the history
Add verify dependencies version to CI
  • Loading branch information
wzshiming authored Jun 26, 2024
2 parents ed269cc + bb5972e commit 27dc070
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 8 deletions.
49 changes: 49 additions & 0 deletions .dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
dependencies:

- name: "zeitgeist"
version: 0.5.3
refPaths:
- path: hack/verify-dependencies-version.sh
match: sigs.k8s.io/zeitgeist@v

- name: "golang"
version: 1.22.3
refPaths:
- path: go.mod
match: "go "
- path: .github/workflows/golangci-lint.yaml
match: "GO_VERSION: "
- path: .github/workflows/releases.yaml
match: "GO_VERSION: "
- path: .github/workflows/test.yaml
match: "GO_VERSION: "
- path: hack/requirements.sh
match: "GO_VERSION="

- name: "golangci"
version: 1.58.2
refPaths:
- path: .github/workflows/golangci-lint.yaml
match: "GOLANGCI_VERSION: "
- path: hack/update-go-lint.sh
match: "golangci-lint@v"
- path: hack/verify-go-lint.sh
match: "golangci-lint@v"

- name: "kind"
version: 0.23.0
refPaths:
- path: hack/requirements.sh
match: "KIND_VERSION="
- path: pkg/consts/consts.go
match: "KindVersion"

- name: "kubernetes"
version: 1.30.0
refPaths:
- path: supported_releases.txt
match: ""
- path: pkg/consts/consts.go
match: "KubeVersion"
- path: hack/requirements.sh
match: "KUBE_VERSION="
9 changes: 7 additions & 2 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ on:
types: [opened, edited, synchronize, reopened]
branches:
- main

env:
GO_VERSION: "1.22.3"
GOLANGCI_VERSION: "1.58.2"

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.58.2
version: v${{ env.GOLANGCI_VERSION }}
args: --timeout=30m --config=.golangci.yaml
3 changes: 2 additions & 1 deletion .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
PUSH: 'true'
PRE_RELEASE: GA
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GO_VERSION: "1.22.3"

jobs:
releases:
Expand All @@ -18,7 +19,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
CGO_ENABLED: "0"
GO_VERSION: "1.22.3"

# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
Expand All @@ -43,7 +44,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}

- name: Test
shell: bash
Expand Down Expand Up @@ -82,7 +83,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}

- name: Test e2e default
shell: bash
Expand All @@ -108,7 +109,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}

- name: Install Kind
shell: bash
Expand Down Expand Up @@ -168,7 +169,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
go-version: ${{ env.GO_VERSION }}

- name: Install CoreUtils for MacOS
if: ${{ startsWith(matrix.os, 'macos-') }}
Expand Down
2 changes: 1 addition & 1 deletion hack/requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export PATH="${LOCAL_BIN_DIR}:${PATH}"

KIND_VERSION=0.23.0

KUBE_VERSION=1.29.0
KUBE_VERSION=1.30.0

# TODO: Stay at 0.9 in figuring out the Attestations of buildx.
# https://github.com/docker/buildx/pull/1412
Expand Down
5 changes: 5 additions & 0 deletions hack/verify-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ if [[ "${VERIFY_STAGES:-true}" == "true" ]]; then
"${ROOT_DIR}"/hack/verify-stages.sh || failed+=(stages)
fi

if [[ "${VERIFY_DEPENDENCIES_VERSION:-true}" == "true" ]]; then
echo "[*] Verifying dependencies version..."
"${ROOT_DIR}"/hack/verify-dependencies-version.sh || failed+=(dependencies-version)
fi

# exit based on verify scripts
if [[ "${#failed[@]}" != 0 ]]; then
echo "Verify failed for: ${failed[*]}"
Expand Down
27 changes: 27 additions & 0 deletions hack/verify-dependencies-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Copyright 2024 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

DIR="$(dirname "${BASH_SOURCE[0]}")"

ROOT_DIR="$(realpath "${DIR}/..")"

go run sigs.k8s.io/[email protected] validate \
--local-only \
--base-path "${ROOT_DIR}" \
--config "${ROOT_DIR}"/.dependencies.yaml

0 comments on commit 27dc070

Please sign in to comment.