Skip to content

Commit 0718db9

Browse files
authored
[shell-operator] сhore/automate versions (#841)
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
1 parent 19e74f3 commit 0718db9

17 files changed

Lines changed: 130 additions & 129 deletions

File tree

.github/workflows/build.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ jobs:
88
name: Build shell-operator binary
99
runs-on: ubuntu-latest
1010
steps:
11-
- name: Set up Go 1.23
11+
- name: Set up Go
1212
uses: actions/setup-go@v5
1313
with:
14-
go-version: "1.23"
15-
14+
go-version: "1.25.5"
1615
- name: Check out shell-operator code
1716
uses: actions/checkout@v4
18-
1917
- name: Restore Go modules
2018
id: go-modules-cache
2119
uses: actions/cache@v4.2.3
2220
with:
2321
path: |
2422
~/go/pkg/mod
2523
key: ${{ runner.os }}-gomod-${{ hashFiles('go.mod', 'go.sum') }}
24+
- name: Check generated code is up to date
25+
run: |
26+
make generate
2627
28+
git diff --exit-code || (echo 'Regenerated code does not match source, please run "make generate"' && exit 1)
2729
- name: Download Go modules
2830
if: steps.go-modules-cache.outputs.cache-hit != 'true'
2931
run: |
3032
go mod download
3133
echo -n "Go modules unpacked size is: " && du -sh $HOME/go/pkg/mod
32-
3334
- name: Build binary
3435
run: |
3536
export GOOS=linux
3637
3738
go build ./cmd/shell-operator
38-
3939
# MacOS build works fine because jq package already has static libraries.
4040
# Windows build requires jq compilation, this should be done in libjq-go.
4141
# TODO Does cross-compile can help here?

.github/workflows/checks.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
name: PR Checks
2-
32
on:
43
pull_request:
54
types: [opened, labeled, unlabeled, synchronize]
6-
75
jobs:
86
release-label:
97
name: Release note label
108
runs-on: ubuntu-latest
11-
129
steps:
1310
- name: Check minimum labels
1411
uses: mheap/github-action-required-labels@v5

.github/workflows/docs.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
name: Docs
2-
32
on:
43
push:
54
branches:
65
- main
76
pull_request:
8-
97
jobs:
108
deploy:
119
runs-on: ubuntu-24.04
1210
concurrency:
1311
group: ${{ github.workflow }}-${{ github.ref }}
1412
steps:
1513
- uses: actions/checkout@v4
16-
1714
- name: Setup mdBook
1815
uses: peaceiris/actions-mdbook@v2
1916
with:
2017
mdbook-version: '0.4.10'
21-
2218
- run: mdbook build docs
23-
2419
- name: Deploy
2520
uses: peaceiris/actions-gh-pages@v4
2621
if: ${{ github.ref == 'refs/heads/main' }}

.github/workflows/lint.yaml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ name: Lint
44
on:
55
pull_request:
66
types: [opened, synchronize]
7-
87
jobs:
98
run_linter:
109
name: Run linter
1110
runs-on: ubuntu-latest
1211
steps:
13-
- name: Set up Go 1.23
12+
- name: Set up Go
1413
uses: actions/setup-go@v5
1514
with:
16-
go-version: "1.23"
17-
15+
go-version: "1.25.5"
1816
- name: Check out shell-operator code
1917
uses: actions/checkout@v4
20-
2118
- name: Restore Go modules
2219
id: go-modules-cache
2320
uses: actions/cache@v4.2.3
@@ -27,30 +24,24 @@ jobs:
2724
key: ${{ runner.os }}-gomod-${{ hashFiles('go.mod', 'go.sum') }}
2825
restore-keys: |
2926
${{ runner.os }}-gomod-
30-
3127
- name: Download Go modules
3228
if: steps.go-modules-cache.outputs.cache-hit != 'true'
3329
run: |
3430
go mod download
3531
echo -n "Go modules unpacked size is: " && du -sh $HOME/go/pkg/mod
36-
3732
- name: Run golangci-lint
3833
run: |
39-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v2.1.6
34+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v2.8.0
4035
./golangci-lint run --build-tags integration,test
41-
42-
4336
codespell:
4437
name: Run codespell
4538
runs-on: ubuntu-latest
4639
steps:
4740
- uses: actions/setup-python@v5
4841
with:
4942
python-version: 3.8
50-
5143
- name: Check out addon-operator code
5244
uses: actions/checkout@v4
53-
5445
- name: Run codespell
5546
run: |
5647
pip install codespell==v1.17.1

.github/workflows/publish-dev.yaml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ env:
1111
BUILDX_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
1212
BUILDX_PLATFORMS_AMD64: "linux/amd64"
1313
GHCR_IO_REPO: ghcr.io/flant/shell-operator-dev
14-
1514
jobs:
1615
check:
1716
name: Check and remove label
@@ -60,7 +59,6 @@ jobs:
6059
} catch (e) {
6160
console.log(`Error occurred while remove label. Possibly label is already removed. Ignore '${typeof e}' error.`);
6261
}
63-
6462
publish_dev_image:
6563
name: Build and publish
6664
runs-on: ubuntu-latest
@@ -69,7 +67,6 @@ jobs:
6967
if: needs.check.outputs.run_publish == 'true'
7068
steps:
7169
- uses: actions/checkout@v4
72-
7370
- name: Prepare environment
7471
env:
7572
BUILD_MULTI_ARCH: ${{ needs.check.outputs.build_multi_arch }}
@@ -93,26 +90,22 @@ jobs:
9390
echo "BUILD_MULTI_ARCH = ${BUILD_MULTI_ARCH}"
9491
echo "BUILDX_PLATFORMS = ${BUILDX_PLATFORMS}"
9592
echo "========================================="
96-
9793
- name: Set up QEMU
9894
if: needs.check.outputs.build_multi_arch == 'true'
9995
uses: docker/setup-qemu-action@v3.6.0
10096
with:
10197
platforms: "${{ env.QEMU_PLATFORMS }}"
102-
10398
- name: Set up Docker Buildx
10499
id: buildx
105100
uses: docker/setup-buildx-action@v3
106101
with:
107102
version: latest
108-
109103
- name: Login to Github Container Registry
110104
uses: docker/login-action@v3.4.0
111105
with:
112106
registry: ghcr.io
113107
username: ${{ secrets.GHCR_IO_USER }}
114108
password: ${{ secrets.GHCR_IO_PASS }}
115-
116109
- name: Build and push using buildx
117110
run: |
118111
echo "Build ${GHCR_IO_IMAGE_NAME} with version '${APP_VERSION}'"
@@ -121,32 +114,6 @@ jobs:
121114
--build-arg appVersion=$APP_VERSION \
122115
--tag $GHCR_IO_IMAGE_NAME \
123116
--push .
124-
125117
- name: Inspect binaries
126118
if: needs.check.outputs.build_multi_arch == 'true'
127-
run: |
128-
# Image for one arhitecture has digest in config field.
129-
# Image with multiple manifests has digest in each manifest.
130-
manifests=$(docker buildx imagetools inspect "${GHCR_IO_IMAGE_NAME}" --raw)
131-
if grep manifests <<<"${manifests}" 2>&1 >/dev/null ; then
132-
jq -r '.manifests[]? | .digest + " " + .platform.os + "/" + .platform.architecture' <<<"${manifests}" \
133-
| while read digest platform ; do
134-
image=${GHCR_IO_IMAGE_NAME}@${digest}
135-
if [[ ${BUILDX_PLATFORMS} != *"${platform}"* ]] ; then
136-
echo "====================================="
137-
echo "Ignore image for non-runnable platform ${platform}"
138-
echo " ${image}"
139-
echo "====================================="
140-
continue
141-
fi
142-
echo "====================================="
143-
echo "Inspect image for platform ${platform}"
144-
echo " ${image}"
145-
echo "====================================="
146-
docker run --rm --platform ${platform} --entrypoint sh ${image} -c \
147-
'apk add file > /dev/null; file /bin/kubectl; file /bin/busybox; file /shell-operator'
148-
done
149-
else
150-
echo Not a multi-arhitecture image.
151-
#echo $(echo -n "${manifests}" | openssl dgst -sha256) ' linux/amd64'
152-
fi
119+
run: "# Image for one arhitecture has digest in config field.\n# Image with multiple manifests has digest in each manifest.\nmanifests=$(docker buildx imagetools inspect \"${GHCR_IO_IMAGE_NAME}\" --raw)\nif grep manifests <<<\"${manifests}\" 2>&1 >/dev/null ; then\n jq -r '.manifests[]? | .digest + \" \" + .platform.os + \"/\" + .platform.architecture' <<<\"${manifests}\" \\\n | while read digest platform ; do\n image=${GHCR_IO_IMAGE_NAME}@${digest}\n if [[ ${BUILDX_PLATFORMS} != *\"${platform}\"* ]] ; then\n echo \"=====================================\"\n echo \"Ignore image for non-runnable platform ${platform}\"\n echo \" ${image}\"\n echo \"=====================================\"\n continue \n fi\n echo \"=====================================\"\n echo \"Inspect image for platform ${platform}\"\n echo \" ${image}\"\n echo \"=====================================\"\n docker run --rm --platform ${platform} --entrypoint sh ${image} -c \\\n 'apk add file > /dev/null; file /bin/kubectl; file /bin/busybox; file /shell-operator'\n done\nelse\n echo Not a multi-arhitecture image.\n #echo $(echo -n \"${manifests}\" | openssl dgst -sha256) ' linux/amd64'\nfi\n"

.github/workflows/publish-release.yaml

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
# Build tag from release name when release is published.
33
# Build 'latest' tag when release is published and marked as 'latest'.
44
name: Publish release image
5-
65
on:
76
workflow_dispatch:
87
release:
98
types: [published]
10-
119
env:
1210
QEMU_PLATFORMS: arm64,arm
1311
BUILDX_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
1412
DOCKER_HUB_REPO: flant/shell-operator
1513
GHCR_IO_REPO: ghcr.io/flant/shell-operator
16-
1714
jobs:
1815
check:
1916
name: Check
@@ -73,7 +70,6 @@ jobs:
7370
core.setOutput('run_publish', runPublish.toString());
7471
core.setOutput('image_tag', imageTag);
7572
core.setOutput('additional_tag', additionalTag);
76-
7773
publish_image:
7874
name: Build and publish
7975
runs-on: [ubuntu-latest]
@@ -82,7 +78,6 @@ jobs:
8278
if: needs.check.outputs.run_publish == 'true'
8379
steps:
8480
- uses: actions/checkout@v4
85-
8681
- name: Prepare environment
8782
env:
8883
ADDITIONAL_TAG: ${{ needs.check.outputs.additional_tag }}
@@ -116,25 +111,21 @@ jobs:
116111
echo "ADDITIONAL_DOCKER_HUB_IMAGE_NAME = $ADDITIONAL_DOCKER_HUB_IMAGE_NAME" && \
117112
echo "ADDITIONAL_GHCR_IO_IMAGE_NAME = $ADDITIONAL_GHCR_IO_IMAGE_NAME"
118113
echo "========================================="
119-
120114
- name: Set up QEMU
121115
uses: docker/setup-qemu-action@v3.6.0
122116
with:
123117
platforms: "${{ env.QEMU_PLATFORMS }}"
124-
125118
- name: Set up Docker Buildx
126119
id: buildx
127120
uses: docker/setup-buildx-action@v3
128121
with:
129122
version: latest
130-
131123
- name: Login to Github Container Registry
132124
uses: docker/login-action@v3.4.0
133125
with:
134126
registry: ghcr.io
135127
username: ${{ secrets.GHCR_IO_USER }}
136128
password: ${{ secrets.GHCR_IO_PASS }}
137-
138129
- name: Build and push multi-arch image
139130
run: |
140131
echo "Build and push $FINAL_IMAGE_NAME with version '$APP_VERSION'."
@@ -147,45 +138,19 @@ jobs:
147138
--tag $GHCR_IO_IMAGE_NAME \
148139
--push \
149140
.
150-
151141
- name: Inspect binaries
152-
run: |
153-
# Image for one arhitecture has digest in config field.
154-
# Image with multiple manifests has digest in each manifest.
155-
manifests=$(docker buildx imagetools inspect "${GHCR_IO_IMAGE_NAME}" --raw)
156-
if grep manifests <<<"${manifests}" 2>&1 >/dev/null ; then
157-
jq -r '.manifests[]? | .digest + " " + .platform.os + "/" + .platform.architecture' <<<"${manifests}"
158-
else
159-
echo $(echo -n "${manifests}" | openssl dgst -sha256 | sed s/^.stdin.*\ //) ' linux/amd64'
160-
fi \
161-
| while read digest platform ; do
162-
if [[ ${BUILDX_PLATFORMS} != *"${platform}"* ]] ; then
163-
echo "====================================="
164-
echo "Ignore image for non-runnable platform ${platform}"
165-
echo " ${image}"
166-
echo "====================================="
167-
continue
168-
fi
169-
image=${GHCR_IO_IMAGE_NAME}@${digest}
170-
echo "====================================="
171-
echo "Inspect image for platform ${platform}"
172-
echo " ${image}"
173-
echo "====================================="
174-
docker run --rm --platform ${platform} --entrypoint sh ${image} -c \
175-
'apk add file > /dev/null; file /bin/kubectl; file /bin/busybox; file /shell-operator'
176-
done
177-
142+
run: "# Image for one arhitecture has digest in config field.\n# Image with multiple manifests has digest in each manifest.\nmanifests=$(docker buildx imagetools inspect \"${GHCR_IO_IMAGE_NAME}\" --raw)\nif grep manifests <<<\"${manifests}\" 2>&1 >/dev/null ; then\n jq -r '.manifests[]? | .digest + \" \" + .platform.os + \"/\" + .platform.architecture' <<<\"${manifests}\"\nelse\n echo $(echo -n \"${manifests}\" | openssl dgst -sha256 | sed s/^.stdin.*\\ //) ' linux/amd64'\nfi \\\n| while read digest platform ; do\n if [[ ${BUILDX_PLATFORMS} != *\"${platform}\"* ]] ; then\n echo \"=====================================\"\n echo \"Ignore image for non-runnable platform ${platform}\"\n echo \" ${image}\"\n echo \"=====================================\"\n continue \n fi\n image=${GHCR_IO_IMAGE_NAME}@${digest}\n echo \"=====================================\"\n echo \"Inspect image for platform ${platform}\"\n echo \" ${image}\"\n echo \"=====================================\"\n docker run --rm --platform ${platform} --entrypoint sh ${image} -c \\\n 'apk add file > /dev/null; file /bin/kubectl; file /bin/busybox; file /shell-operator'\ndone\n"
178143
- name: Copy image to Docker Hub
179144
env:
180145
DOCKER_USER: ${{ secrets.DOCKER_USER }}
181146
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
182147
run: |
183148
echo "Download crane tool ..."
184-
149+
185150
CRANE_VERSION=$(curl -s "https://api.github.com/repos/google/go-containerregistry/releases/latest" | jq -r '.tag_name')
186151
CRANE_OS=Linux # or Darwin, Windows
187152
CRANE_ARCH=x86_64 # or arm64, x86_64, armv6, i386, s390x, riscv64
188-
153+
189154
echo "Crane version: ${CRANE_VERSION}, OS: ${CRANE_OS}, ARCH: ${CRANE_ARCH}"
190155
curl -sL "https://github.com/google/go-containerregistry/releases/download/${CRANE_VERSION}/go-containerregistry_${CRANE_OS}_${CRANE_ARCH}.tar.gz" > go-containerregistry.tar.gz
191156
echo "Extract crane tool ..."

.github/workflows/tests-labeled.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
} catch (e) {
3737
console.log(`Error occurred while remove label. Possibly label is already removed. Ignore '${typeof e}' error.`);
3838
}
39-
4039
integration_tests:
4140
name: Integration tests
4241
needs:
@@ -63,14 +62,12 @@ jobs:
6362
cluster_name: "kube-1-32"
6463
runs-on: ubuntu-latest
6564
steps:
66-
- name: Set up Go 1.23
65+
- name: Set up Go
6766
uses: actions/setup-go@v5
6867
with:
69-
go-version: "1.23"
70-
68+
go-version: "1.25.5"
7169
- name: Check out shell-operator code
7270
uses: actions/checkout@v4
73-
7471
- name: Restore Go modules
7572
id: go-modules-cache
7673
uses: actions/cache@v4.2.3
@@ -80,27 +77,23 @@ jobs:
8077
key: ${{ runner.os }}-gomod-${{ hashFiles('go.mod', 'go.sum') }}
8178
restore-keys: |
8279
${{ runner.os }}-gomod-
83-
8480
- name: Download Go modules
8581
if: steps.go-modules-cache.outputs.cache-hit != 'true'
8682
run: |
8783
go mod download
8884
echo -n "Go modules unpacked size is: " && du -sh $HOME/go/pkg/mod
89-
9085
- name: Install ginkgo
9186
run: |
92-
go install github.com/onsi/ginkgo/v2/ginkgo@latest
87+
go install github.com/onsi/ginkgo/v2/ginkgo@v2.27.5
9388
echo $PATH
9489
ls -la $GOPATH/bin
9590
ginkgo version
96-
9791
- name: Start kind cluster
9892
uses: engineerd/setup-kind@v0.6.2
9993
with:
10094
version: "v0.27.0"
10195
image: ${{ matrix.kind_node_image }}
10296
name: ${{ matrix.cluster_name }}
103-
10497
- name: Run integration tests
10598
env:
10699
CLUSTER_NAME: ${{ matrix.cluster_name }}

0 commit comments

Comments
 (0)