Skip to content

Commit 1f39e29

Browse files
committed
Split off verify-vpa into it's own action
This allows us to use a different version of Go to the rest of the projects in this repo
1 parent 89b1f7f commit 1f39e29

File tree

4 files changed

+116
-31
lines changed

4 files changed

+116
-31
lines changed

.github/workflows/vpa-verify.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Vertical Pod Autoscaler
2+
3+
on:
4+
push:
5+
paths:
6+
- 'vertical-pod-autoscaler/**'
7+
- '!vertical-pod-autoscaler/**/*.md'
8+
pull_request:
9+
paths:
10+
- 'vertical-pod-autoscaler/**'
11+
- '!vertical-pod-autoscaler/**/*.md'
12+
13+
env:
14+
GOPATH: ${{ github.workspace }}/go
15+
16+
permissions:
17+
contents: read
18+
checks: write
19+
20+
jobs:
21+
verify:
22+
name: verify
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
with:
27+
path: ${{ env.GOPATH }}/src/k8s.io/autoscaler
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
31+
with:
32+
go-version-file: '${{ env.GOPATH}}/src/k8s.io/autoscaler/vertical-pod-autoscaler/go.mod'
33+
cache-dependency-path: |
34+
${{ env.GOPATH}}/src/k8s.io/autoscaler/vertical-pod-autoscaler/go.sum
35+
36+
- name: Verify
37+
working-directory: ${{ env.GOPATH }}/src/k8s.io/autoscaler/vertical-pod-autoscaler
38+
run: hack/verify-all.sh -v
39+
env:
40+
GO111MODULE: auto

hack/verify-all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2014 The Kubernetes Authors.
3+
# Copyright The Kubernetes Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

hack/verify-vpa.sh

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/bin/bash
2+
3+
# Copyright The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -o errexit
18+
set -o nounset
19+
set -o pipefail
20+
21+
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
22+
source "${KUBE_ROOT}/../hack/kube-env.sh"
23+
24+
SILENT=true
25+
EXCLUDE=${EXCLUDE:-} # nothing excluded by default
26+
27+
function is-excluded {
28+
if [[ $1 -ef ${BASH_SOURCE} ]]; then
29+
return
30+
fi
31+
for e in $EXCLUDE; do
32+
if [[ $1 -ef "$KUBE_ROOT/hack/$e" ]]; then
33+
return
34+
fi
35+
done
36+
return 1
37+
}
38+
39+
while getopts ":v" opt; do
40+
case $opt in
41+
v)
42+
SILENT=false
43+
;;
44+
\?)
45+
echo "Invalid flag: -$OPTARG" >&2
46+
exit 1
47+
;;
48+
esac
49+
done
50+
51+
if $SILENT ; then
52+
echo "Running in the silent mode, run with -v if you want to see script logs."
53+
fi
54+
55+
ret=0
56+
for t in `ls $KUBE_ROOT/hack/verify-*.sh`
57+
do
58+
if is-excluded $t ; then
59+
echo "Skipping $t"
60+
continue
61+
fi
62+
if ! $SILENT ; then
63+
echo -e "Verifying $t"
64+
if bash "$t"; then
65+
echo -e "${color_green}SUCCESS${color_norm}"
66+
else
67+
echo -e "${color_red}FAILED${color_norm}"
68+
ret=1
69+
fi
70+
else
71+
bash "$t" &> /dev/null || ret=1
72+
fi
73+
done
74+
75+
exit $ret

0 commit comments

Comments
 (0)