Skip to content

Commit e18c5b6

Browse files
committed
Merge branch 'main' into manage-karpenter-wc-crs
2 parents c758572 + 6a7e7c5 commit e18c5b6

13 files changed

+89
-454
lines changed

.github/workflows/pre_commit_go.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,24 @@ jobs:
1212
pre-commit:
1313
runs-on: ubuntu-24.04
1414
steps:
15-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16-
- uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
17-
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
15+
- name: Check out code
16+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- name: Set up Python environment
18+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
19+
- name: Set up Go environment
20+
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
1821
with:
1922
go-version: "1.24"
2023
- name: Install goimports
2124
run: |
22-
go install golang.org/x/tools/cmd/goimports@v0.31.0
25+
go install golang.org/x/tools/cmd/goimports@v0.34.0
2326
- name: Install golangci-lint
2427
uses: giantswarm/install-binary-action@c37eb401e5092993fc76d545030b1d1769e61237 # v3.0.0
2528
with:
2629
binary: golangci-lint
2730
version: "2.1.6"
2831
download_url: "https://github.com/golangci/golangci-lint/releases/download/v${version}/${binary}-${version}-linux-amd64.tar.gz"
29-
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
32+
- name: Execute pre-commit hooks
33+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
3034
env:
3135
GOGC: "20"

.github/workflows/zz_generated.check_values_schema.yaml

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
#
33
# devctl
44
#
5-
# https://github.com/giantswarm/devctl/blob/f2b5cf71dfa175afa70f721eca503072d0e7d4c4/pkg/gen/input/workflows/internal/file/check_values_schema.yaml.template
5+
# https://github.com/giantswarm/devctl/blob/366c1c3aad2b9b02850a54854aba8108db3ce052/pkg/gen/input/workflows/internal/file/check_values_schema.yaml.template
66
#
7+
78
name: 'Values and schema'
9+
810
on:
911
pull_request:
1012
branches:
@@ -15,41 +17,6 @@ on:
1517
- 'helm/**/values.schema.json' # schema
1618
- 'helm/**/ci/ci-values.yaml' # overrides for CI (can contain required entries)
1719

18-
push: {}
19-
2020
jobs:
2121
check:
22-
name: 'validate values.yaml against values.schema.json'
23-
runs-on: ubuntu-24.04
24-
steps:
25-
- name: Checkout
26-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27-
with:
28-
fetch-depth: 0
29-
30-
- name: Install validator
31-
run: |
32-
wget -q -O ${HOME}/yajsv https://github.com/neilpa/yajsv/releases/download/v1.4.1/yajsv.linux.amd64
33-
chmod +x ${HOME}/yajsv
34-
35-
- name: 'Check if values.yaml is a valid instance of values.schema.json'
36-
run: |
37-
for chart_yaml in helm/*/Chart.yaml; do
38-
helm_dir="${chart_yaml%/Chart.yaml}"
39-
40-
if [ ! -f ${helm_dir}/values.schema.json ]; then
41-
echo "Skipping validation for '${helm_dir}' folder, because 'values.schema.json' does not exist..."
42-
continue
43-
fi
44-
45-
values=${helm_dir}/values.yaml
46-
if [ -f ${helm_dir}/ci/ci-values.yaml ]; then
47-
# merge ci-values.yaml into values.yaml (providing required values)
48-
echo -e "\nMerged values:\n=============="
49-
yq '. *= load("'${helm_dir}'/ci/ci-values.yaml")' ${helm_dir}/values.yaml | tee ${helm_dir}/combined-values.yaml
50-
echo -e "\n==============\n"
51-
values=${helm_dir}/combined-values.yaml
52-
fi
53-
54-
${HOME}/yajsv -s ${helm_dir}/values.schema.json ${values}
55-
done
22+
uses: giantswarm/github-workflows/.github/workflows/chart-values.yaml@897ce7c11f81fcd01f7cf38e839a42848a63c7e7

.github/workflows/zz_generated.create_release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# devctl
44
#
5-
# https://github.com/giantswarm/devctl/blob/9fedf13cca653e8c1828fdc57294c06273e427d6/pkg/gen/input/workflows/internal/file/create_release.yaml.template
5+
# https://github.com/giantswarm/devctl/blob/7f65ea49e4e543a7b39a7b3cf70038a3e16641a5/pkg/gen/input/workflows/internal/file/create_release.yaml.template
66
#
77
name: Create Release
88
on:

.github/workflows/zz_generated.create_release_pr.yaml

Lines changed: 8 additions & 239 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# devctl
44
#
5-
# https://github.com/giantswarm/devctl/blob/771e68c7deeda0e8cbd4af23d718a34e708822e4/pkg/gen/input/workflows/internal/file/create_release_pr.yaml.template
5+
# https://github.com/giantswarm/devctl/blob/366c1c3aad2b9b02850a54854aba8108db3ce052/pkg/gen/input/workflows/internal/file/create_release_pr.yaml.template
66
#
77
name: Create Release PR
88
on:
@@ -29,242 +29,11 @@ on:
2929
branch:
3030
required: true
3131
type: string
32-
jobs:
33-
debug_info:
34-
name: Debug info
35-
runs-on: ubuntu-22.04
36-
steps:
37-
- name: Print github context JSON
38-
run: |
39-
cat <<EOF
40-
${{ toJson(github) }}
41-
EOF
42-
gather_facts:
43-
name: Gather facts
44-
runs-on: ubuntu-22.04
45-
outputs:
46-
repo_name: ${{ steps.gather_facts.outputs.repo_name }}
47-
branch: ${{ steps.gather_facts.outputs.branch }}
48-
base: ${{ steps.gather_facts.outputs.base }}
49-
needs_major_bump: ${{ steps.gather_facts.outputs.needs_major_bump }}
50-
skip: ${{ steps.pr_exists.outputs.skip }}
51-
version: ${{ steps.gather_facts.outputs.version }}
52-
steps:
53-
- name: Gather facts
54-
id: gather_facts
55-
run: |
56-
head="${{ inputs.branch || github.event.ref }}"
57-
echo "branch=${head}" >> $GITHUB_OUTPUT
58-
59-
head="${head#refs/heads/}" # Strip "refs/heads/" prefix.
60-
if [[ $(echo "$head" | grep -o '#' | wc -l) -gt 1 ]]; then
61-
base="$(echo $head | cut -d '#' -f 1)"
62-
else
63-
base="${{ github.event.base_ref }}"
64-
fi
65-
66-
base="${base#refs/heads/}" # Strip "refs/heads/" prefix.
67-
68-
version="$(echo $head | awk -F# '{print $NF}')"
69-
if [[ $version =~ ^major|minor|patch$ ]]; then
70-
gh auth login --with-token <<<$(echo -n ${{ secrets.TAYLORBOT_GITHUB_ACTION }})
71-
gh_api_get_latest_release_version()
72-
{
73-
if ! version="$(gh api "repos/$1/releases/latest" --jq '.tag_name[1:] | split(".") | .[0], .[1], .[2]')"
74-
then
75-
case "$version" in
76-
*Not\ Found*) echo Assuming v0.0.0, hooray first release! >&2 ; version="0 0 0" ;;
77-
*) version="" ; return 1 ;;
78-
esac
79-
fi
80-
echo "$version"
81-
}
82-
83-
version_parts=($(gh_api_get_latest_release_version "${{ github.repository }}"))
84-
version_major=${version_parts[0]}
85-
version_minor=${version_parts[1]}
86-
version_patch=${version_parts[2]}
87-
case ${version} in
88-
patch)
89-
version_patch=$((version_patch+1))
90-
;;
91-
minor)
92-
version_minor=$((version_minor+1))
93-
version_patch=0
94-
;;
95-
major)
96-
version_major=$((version_major+1))
97-
version_minor=0
98-
version_patch=0
99-
if [[ "${version_major}" != "1" ]]; then
100-
echo "needs_major_bump=true" >> $GITHUB_OUTPUT
101-
fi
102-
;;
103-
*)
104-
echo "Unknown Semver level provided"
105-
exit 1
106-
;;
107-
esac
108-
version="${version_major}.${version_minor}.${version_patch}"
109-
else
110-
version="${version#v}" # Strip "v" prefix.
111-
version_major=$(echo "${version}" | cut -d "." -f 1)
112-
version_minor=$(echo "${version}" | cut -d "." -f 2)
113-
version_patch=$(echo "${version}" | cut -d "." -f 3)
114-
# This will help us detect versions with suffixes as majors, i.e 3.0.0-alpha1.
115-
# Even though it's a pre-release, it's still a major.
116-
if [[ $version_minor = 0 && $version_patch =~ ^0.* && $version_major != 1 ]]; then
117-
echo "needs_major_bump=true" >> $GITHUB_OUTPUT
118-
fi
119-
fi
120-
repo_name="$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')"
121-
echo "repo_name=\"$repo_name\" base=\"$base\" head=\"$head\" version=\"$version\""
122-
echo "repo_name=${repo_name}" >> $GITHUB_OUTPUT
123-
echo "base=${base}" >> $GITHUB_OUTPUT
124-
echo "head=${head}" >> $GITHUB_OUTPUT
125-
echo "version=${version}" >> $GITHUB_OUTPUT
126-
- name: Check if PR exists
127-
id: pr_exists
128-
env:
129-
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}"
130-
run: |
131-
head="${{ steps.gather_facts.outputs.branch }}"
132-
branch="${head#refs/heads/}" # Strip "refs/heads/" prefix.
133-
if gh pr view --repo "${{ github.repository }}" "${branch}" --json state --jq .state | grep -i 'open' > /dev/null; then
134-
gh pr view --repo "${{ github.repository }}" "${branch}"
135-
echo "skip=true" >> $GITHUB_OUTPUT
136-
else
137-
echo "skip=false" >> $GITHUB_OUTPUT
138-
fi
139-
prepare_release_pr:
140-
name: Prepare release PR for Backstage project
141-
runs-on: ubuntu-22.04
142-
needs:
143-
- gather_facts
144-
if: ${{ needs.gather_facts.outputs.skip != 'true' && github.repository == 'giantswarm/backstage' }}
145-
steps:
146-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
147-
with:
148-
ref: ${{ needs.gather_facts.outputs.branch }}
149-
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
150-
with:
151-
node-version: '20'
152-
- uses: borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
153-
with:
154-
cmd: install
155-
- name: Prepare release PR
156-
uses: borales/actions-yarn@3766bb1335b98fb13c60eaf358fe20811b730a88 # v5.0.0
157-
with:
158-
cmd: release
159-
env:
160-
RELEASE_VERSION: ${{ needs.gather_facts.outputs.version }}
161-
- name: Set up git identity
162-
run: |
163-
git config --local user.email "[email protected]"
164-
git config --local user.name "taylorbot"
165-
- name: Create commit
166-
env:
167-
version: "${{ needs.gather_facts.outputs.version }}"
168-
run: |
169-
git add -A
170-
git commit -m "Prepare release v${{ env.version }}"
171-
- name: Push changes
172-
env:
173-
remote_repo: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git"
174-
run: |
175-
git push "${remote_repo}" HEAD:${{ needs.gather_facts.outputs.branch }}
176-
create_release_pr:
177-
name: Create release PR
178-
runs-on: ubuntu-22.04
179-
needs:
180-
- gather_facts
181-
- prepare_release_pr
182-
if: ${{ always() && needs.gather_facts.outputs.skip != 'true' }}
183-
env:
184-
architect_flags: "--organisation ${{ github.repository_owner }} --project ${{ needs.gather_facts.outputs.repo_name }}"
185-
steps:
186-
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
187-
with:
188-
go-version: '=1.23'
189-
- name: Install architect
190-
uses: giantswarm/install-binary-action@c37eb401e5092993fc76d545030b1d1769e61237 # v3.0.0
191-
with:
192-
binary: "architect"
193-
version: "6.17.0"
194-
- name: Checkout code
195-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
196-
with:
197-
ref: ${{ needs.gather_facts.outputs.branch }}
198-
- name: Prepare release changes
199-
run: |
200-
architect prepare-release ${{ env.architect_flags }} --version "${{ needs.gather_facts.outputs.version }}"
201-
- name: Update version field in Chart.yaml
202-
run: |
203-
# Define chart_dir
204-
repository="${{ needs.gather_facts.outputs.repo_name }}"
205-
chart="helm/${repository}"
206-
207-
# Check chart directory.
208-
if [ ! -d "${chart}" ]
209-
then
210-
echo "Could not find chart directory '${chart}', adding app suffix."
211-
212-
# Add app suffix.
213-
chart="helm/${repository}-app"
21432

215-
# Check chart directory with app suffix.
216-
if [ ! -d "${chart}" ]
217-
then
218-
echo "Could not find chart directory '${chart}', removing app suffix."
219-
220-
# Remove app suffix.
221-
chart="helm/${repository%-app}"
222-
223-
if [ ! -d "${chart}" ]
224-
then
225-
# Print error.
226-
echo "Could not find chart directory '${chart}', doing nothing."
227-
fi
228-
fi
229-
fi
230-
231-
# Define chart YAML.
232-
chart_yaml="${chart}/Chart.yaml"
233-
234-
# Check chart YAML.
235-
if [ -f "${chart_yaml}" ]
236-
then
237-
# check if version in Chart.yaml is templated using architect
238-
if [ $(grep -c "^version:.*\.Version.*$" "${chart_yaml}") = "0" ]; then
239-
yq -i '.version = "${{ needs.gather_facts.outputs.version }}"' "${chart_yaml}"
240-
fi
241-
fi
242-
243-
- name: Bump go module defined in go.mod if needed
244-
run: |
245-
if [ "${{ needs.gather_facts.outputs.needs_major_bump }}" = true ] && test -f "go.mod"; then
246-
go install github.com/marwan-at-work/mod/cmd/[email protected]
247-
mod upgrade
248-
fi
249-
- name: Set up git identity
250-
run: |
251-
git config --local user.email "[email protected]"
252-
git config --local user.name "taylorbot"
253-
- name: Create release commit
254-
env:
255-
version: "${{ needs.gather_facts.outputs.version }}"
256-
run: |
257-
git add -A
258-
git commit -m "Release v${{ env.version }}"
259-
- name: Push changes
260-
env:
261-
remote_repo: "https://${{ github.actor }}:${{ secrets.TAYLORBOT_GITHUB_ACTION }}@github.com/${{ github.repository }}.git"
262-
run: |
263-
git push "${remote_repo}" HEAD:${{ needs.gather_facts.outputs.branch }}
264-
- name: Create PR
265-
env:
266-
GITHUB_TOKEN: "${{ secrets.TAYLORBOT_GITHUB_ACTION }}"
267-
base: "${{ needs.gather_facts.outputs.base }}"
268-
version: "${{ needs.gather_facts.outputs.version }}"
269-
run: |
270-
gh pr create --assignee ${{ github.actor }} --title "Release v${{ env.version }}" --body "" --base ${{ env.base }} --head "${{ needs.gather_facts.outputs.branch }}"
33+
jobs:
34+
publish:
35+
uses: giantswarm/github-workflows/.github/workflows/create-release-pr.yaml@897ce7c11f81fcd01f7cf38e839a42848a63c7e7
36+
with:
37+
branch: ${{ inputs.branch }}
38+
secrets:
39+
TAYLORBOT_GITHUB_ACTION: ${{ secrets.TAYLORBOT_GITHUB_ACTION }}

0 commit comments

Comments
 (0)