Skip to content

Commit 720bc09

Browse files
committed
Update templated files to rev 6fbe9fa (#369)
Automatically created PR based on commit 6fbe9fa9324e71c0e173b376a05157c9c934aea9 in stackabletech/operator-templating repo. Triggered by: Manual run triggered by: adwk67 with message [23.1 release prep: rust-version set to 1.65]
1 parent ea78eb3 commit 720bc09

10 files changed

Lines changed: 74 additions & 1611 deletions

File tree

.github/workflows/build.yml

Lines changed: 40 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- trying
1010
- "renovate/**"
1111
tags:
12-
- "*"
12+
- '[0-9][0-9].[0-9]+.[0-9]+'
1313
pull_request:
1414

1515
env:
@@ -19,11 +19,11 @@ env:
1919
RUSTFLAGS: "-D warnings"
2020
RUSTDOCFLAGS: "-D warnings"
2121
RUST_LOG: "info"
22-
OPERATOR_NAME: "trino-operator"
23-
PRODUCT_NAME: "trino"
2422
DEV_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-dev
2523
TEST_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-test
2624
STABLE_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-stable
25+
# TODO remove before final go-live!
26+
EXP_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-experimental
2727

2828
jobs:
2929
# Identify unused dependencies
@@ -56,68 +56,49 @@ jobs:
5656
with:
5757
command: udeps
5858

59-
prerelease_job:
60-
name: Returns the pre-release string from the version of the cargo workspace.
61-
runs-on: ubuntu-latest
62-
outputs:
63-
str: ${{ steps.prerelease.outputs.str }}
64-
steps:
65-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
66-
with:
67-
submodules: recursive
68-
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4
69-
- name: Install requirements for version tool
70-
run: pip install -r python/requirements.txt
71-
- id: prerelease
72-
name: Extract the pre-release string. Might be empty.
73-
run: |
74-
PRERELEASE=$(python/cargo_version.py -o | sed "s/^[0-9]\+\.[0-9]\+\.[0-9]\+-\?//g")
75-
echo "::set-output name=str::$PRERELEASE"
76-
7759
# This job evaluates the github environment to determine why this action is running and selects the appropriate
7860
# target repository for published Helm charts based on this.
7961
#
8062
# The following scenarios are identified:
81-
# - pull request:
63+
# - all pull requests land in the test repository:
8264
# condition: github.event_name == "pull_request"
8365
# repository: test
8466
#
85-
# - release (aka a tag was created):
67+
# - all tagged releases land in stable:
8668
# condition: github.event_name == 'create' & github.ref.startswith('refs/tags/')
8769
# repository: stable
8870
#
89-
# - merge of pr to main branch and pre release is nightly:
90-
# condition: github.event_name == 'push' & github.ref == 'refs/heads/main' & needs.prerelease_job.outputs.str == 'nightly'
71+
# - all pushes to main (i.e. PR-merges) land in dev:
72+
# condition: github.event_name == 'push' & github.ref == 'refs/heads/main'
9173
# repository: dev
9274
#
93-
# Any other scenarios will cause the publish step to be skipped, most commonly this is expected to happen for the
75+
# Any other scenarios (e.g. when a branch is created/pushed) will cause the publish step to be skipped, most commonly this is expected to happen for the
9476
# branches that bors uses internally (staging, trying) for which the checks need to run, but we do not want artifacts
9577
# to be published.
96-
select_repo:
97-
name: Select target repository based on action trigger
78+
select_helm_repo:
79+
name: Select target helm repository based on action trigger
9880
runs-on: ubuntu-latest
9981
outputs:
100-
repository: ${{ steps.selectrepo.outputs.repo }}
101-
needs: prerelease_job
82+
helm_repository: ${{ steps.selecthelmrepo.outputs.helm_repo }}
10283
steps:
103-
- id: selectrepo
84+
- id: selecthelmrepo
10485
env:
10586
TRIGGER: ${{ github.event_name }}
10687
GITHUB_REF: ${{ github.ref }}
107-
PRERELEASE: ${{ needs.prerelease_job.outputs.str }}
10888
run: |
10989
if [[ $TRIGGER == "pull_request" ]]; then
110-
echo "exporting test as target repo: ${{ env.TEST_REPO_HELM_URL }}"
111-
echo "::set-output name=repo::${{ env.TEST_REPO_HELM_URL }}"
112-
elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" && $PRERELEASE == 'nightly' ]]; then
113-
echo "exporting dev as target repo: ${{ env.DEV_REPO_HELM_URL }}"
114-
echo "::set-output name=repo::${{ env.DEV_REPO_HELM_URL }}"
90+
echo "exporting test as target helm repo: ${{ env.TEST_REPO_HELM_URL }}"
91+
echo "::set-output name=helm_repo::${{ env.TEST_REPO_HELM_URL }}"
92+
elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" ]]; then
93+
echo "exporting dev as target helm repo: ${{ env.DEV_REPO_HELM_URL }}"
94+
echo "::set-output name=helm_repo::${{ env.DEV_REPO_HELM_URL }}"
11595
elif [[ ( $TRIGGER == "create" || $TRIGGER == "push" ) && $GITHUB_REF == refs/tags/* ]]; then
116-
echo "exporting stable as target repo: ${{ env.STABLE_REPO_HELM_URL }}"
117-
echo "::set-output name=repo::${{ env.STABLE_REPO_HELM_URL }}"
96+
# TODO replace EXP with STABLE repo name
97+
echo "exporting stable as target helm repo: ${{ env.EXP_REPO_HELM_URL }}"
98+
echo "::set-output name=helm_repo::${{ env.EXP_REPO_HELM_URL }}"
11899
else
119100
echo "Unknown trigger and ref combination encountered, skipping publish step: $TRIGGER $GITHUB_REF"
120-
echo "::set-output name=repo::skip"
101+
echo "::set-output name=helm_repo::skip"
121102
fi
122103
123104
run_cargodeny:
@@ -219,11 +200,6 @@ jobs:
219200

220201
run_tests:
221202
name: Run Cargo Tests
222-
needs:
223-
- run_cargodeny
224-
- run_clippy
225-
- run_rustfmt
226-
- run_rustdoc
227203
runs-on: ubuntu-latest
228204
steps:
229205
- name: Install protoc
@@ -272,23 +248,18 @@ jobs:
272248
script: |
273249
core.setFailed('Committed README are not up to date, please make sure to apply them to the templated partials, and re-commit!')
274250
275-
# This job cleans up the CRDs, Helm charts and Kustomize manifests, followed by rebuilding them
251+
# This job cleans up the CRDs and Helm charts, followed by rebuilding them
276252
# It then runs a `git diff` and fails the entire workflow, if any difference is encountered.
277253
#
278254
# Since CRD files are generated during the 'cargo build' process we need to run this once after
279255
# removing the CRD files to ensure that the checked in versions match what the code expects.
280256
#
281257
# The reason for this step is, that developers are expected to check in up-to-date versions of charts
282-
# and manifests, as we'd otherwise have to build these in CI and commit them back to the PR, which
258+
# as we'd otherwise have to build these in CI and commit them back to the PR, which
283259
# creates all kinds of problems.
284-
# Therefor this failsafe simply aborts anything that has not had charts and manifests rebuilt before pushing.
260+
# This failsafe simply aborts anything that has not had charts rebuilt before pushing.
285261
check_charts:
286-
name: Check if committed Helm & Kustomize Charts were up to date
287-
needs:
288-
- run_cargodeny
289-
- run_clippy
290-
- run_rustfmt
291-
- run_rustdoc
262+
name: Check if committed Helm charts are up to date
292263
runs-on: ubuntu-latest
293264
steps:
294265
- name: Install protoc
@@ -324,25 +295,17 @@ jobs:
324295
script: |
325296
core.setFailed('Committed charts were not up to date, please regenerate and re-commit!')
326297
327-
test_charts:
328-
name: Run Chart Tests
329-
needs:
330-
- check_charts
331-
- run_tests
332-
runs-on: ubuntu-latest
333-
steps:
334-
- name: Checkout
335-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
336-
with:
337-
submodules: recursive
338-
- name: placeholder
339-
run: echo Tests will go here
340-
341298
tests_passed:
342299
name: All tests passed
343300
needs:
344-
- test_charts
345301
- run_udeps
302+
- run_cargodeny
303+
- run_clippy
304+
- run_rustfmt
305+
- run_rustdoc
306+
- run_tests
307+
- check_charts
308+
- check_readme
346309
runs-on: ubuntu-latest
347310
steps:
348311
- name: log
@@ -352,12 +315,12 @@ jobs:
352315
name: Package Charts, Build Docker Image and publish them
353316
needs:
354317
- tests_passed
355-
- select_repo
318+
- select_helm_repo
356319
runs-on: ubuntu-latest
357320
env:
358321
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
359-
REPO: ${{ needs.select_repo.outputs.repository }}
360-
if: needs.select_repo.outputs.repository != 'skip'
322+
HELM_REPO: ${{ needs.select_helm_repo.outputs.helm_repository }}
323+
if: needs.select_helm_repo.outputs.helm_repository != 'skip'
361324
steps:
362325
- name: Install protoc
363326
run: |
@@ -386,22 +349,8 @@ jobs:
386349
if: ${{ github.event_name == 'pull_request' }}
387350
run: python/cargo_version.py -m pr${{ github.event.pull_request.number }}
388351

389-
# Recreate charts with changed version if needed
390-
- name: Clean charts
391-
if: ${{ github.event_name == 'pull_request' }}
392-
run: make chart-clean clean-manifests compile-chart generate-manifests
393-
394-
# Package and publish charts
395-
- name: Package Chart
396-
run: mkdir -p target/helm && helm package --destination target/helm deploy/helm/${{ env.OPERATOR_NAME }}
397-
- name: Build Docker image
398-
if: env.NEXUS_PASSWORD != null # pragma: allowlist secret
399-
run: make docker
400-
- name: Publish Chart
401-
if: env.NEXUS_PASSWORD != null # pragma: allowlist secret
402-
run: >-
403-
/usr/bin/curl
404-
--fail
405-
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
406-
--upload-file "./$(find target/helm/ -name '*.tgz')"
407-
"${{ env.REPO }}/"
352+
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
353+
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
354+
# This is needed for the HELM_REPO variable.
355+
- name: Publish Docker image and Helm chart
356+
run: make -e publish

.readme/partials/borrowed/links.md.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
{% if no_jenkins_job_badge %}{% else %}[![Build Actions Status](https://ci.stackable.tech/job/{{operator_name}}%2doperator%2dit%2dnightly/badge/icon?subject=Integration%20Tests)](https://ci.stackable.tech/job/{{operator_name}}%2doperator%2dit%2dnightly){% endif %}
2+
{% if no_jenkins_job_badge %}{% else %}![Build Actions Status](https://ci.stackable.tech/buildStatus/icon?job={{operator_name}}%2doperator%2dit%2dnightly&subject=Integration%20Tests){% endif %}
33
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/stackabletech/{{operator_name}}-operator/graphs/commit-activity)
44
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://docs.stackable.tech/home/stable/contributor/index.html)
55
[![License OSL3.0](https://img.shields.io/badge/license-OSL3.0-green)](./LICENSE)

Makefile

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
# It is available from Nixpkgs as `yq-go` (`nix shell nixpkgs#yq-go`)
88
# This script also requires `jq` https://stedolan.github.io/jq/
99

10-
.PHONY: docker chart-lint compile-chart
10+
.PHONY: build publish
1111

1212
TAG := $(shell git rev-parse --short HEAD)
13+
OPERATOR_NAME := trino-operator
14+
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-${OPERATOR_NAME}") | .version')
1315

14-
VERSION := $(shell cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="stackable-trino-operator") | .version')
15-
IS_NIGHTLY := $(shell echo "${VERSION}" | grep -- '-nightly$$')
16-
# When rendering docs we want to simplify the version number slightly, only rendering "nightly" for nightly branches
17-
# (since we only render nightlies for the active development trunk anyway) and chopping off the semver patch version otherwise
18-
DOCS_VERSION := $(if ${IS_NIGHTLY},nightly,$(shell echo "${VERSION}" | sed 's/^\([0-9]\+\.[0-9]\+\)\..*$$/\1/'))
19-
export VERSION IS_NIGHTLY DOCS_VERSION
16+
DOCKER_REPO := docker.stackable.tech
17+
# TODO replace this with "stackable" before final-final go-live!
18+
ORGANIZATION := sandbox/test
19+
# this will be overwritten by an environmental variable if called from the github action
20+
HELM_REPO := https://repo.stackable.tech/repository/helm-dev
21+
HELM_CHART_ARTIFACT := target/helm/${OPERATOR_NAME}-${VERSION}.tgz
2022

2123
SHELL=/usr/bin/env bash -euo pipefail
2224

@@ -25,50 +27,50 @@ render-readme:
2527

2628
## Docker related targets
2729
docker-build:
28-
docker build --force-rm --build-arg VERSION=${VERSION} -t "docker.stackable.tech/stackable/trino-operator:${VERSION}" -f docker/Dockerfile .
29-
30-
docker-build-latest: docker-build
31-
docker tag "docker.stackable.tech/stackable/trino-operator:${VERSION}" \
32-
"docker.stackable.tech/stackable/trino-operator:latest"
30+
docker build --force-rm --build-arg VERSION=${VERSION} -t "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}" -f docker/Dockerfile .
3331

3432
docker-publish:
35-
echo "${NEXUS_PASSWORD}" | docker login --username github --password-stdin docker.stackable.tech
36-
docker push --all-tags docker.stackable.tech/stackable/trino-operator
33+
echo "${NEXUS_PASSWORD}" | docker login --username github --password-stdin "${DOCKER_REPO}"
34+
docker push --all-tags "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}"
3735

36+
# TODO remove if not used/needed
3837
docker: docker-build docker-publish
3938

40-
docker-release: docker-build-latest docker-publish
39+
helm-publish:
40+
curl --fail -u "github:${NEXUS_PASSWORD}" --upload-file "${HELM_CHART_ARTIFACT}" "${HELM_REPO}/"
41+
42+
helm-package:
43+
mkdir -p target/helm && helm package --destination target/helm deploy/helm/${OPERATOR_NAME}
4144

4245
## Chart related targets
4346
compile-chart: version crds config
4447

4548
chart-clean:
46-
rm -rf deploy/helm/trino-operator/configs
47-
rm -rf deploy/helm/trino-operator/crds
49+
rm -rf "deploy/helm/${OPERATOR_NAME}/configs"
50+
rm -rf "deploy/helm/${OPERATOR_NAME}/crds"
4851

4952
version:
50-
yq eval -i '.version = strenv(VERSION) | .appVersion = strenv(VERSION)' /dev/stdin < deploy/helm/trino-operator/Chart.yaml
51-
yq eval -i '.version = strenv(DOCS_VERSION) | .prerelease = strenv(IS_NIGHTLY) != ""' /dev/stdin < docs/antora.yml
53+
yq eval -i ".version = \"${VERSION}\" | .appVersion = \"${VERSION}\"" /dev/stdin < "deploy/helm/${OPERATOR_NAME}/Chart.yaml"
5254

5355
config:
5456
if [ -d "deploy/config-spec/" ]; then\
55-
mkdir -p deploy/helm/trino-operator/configs;\
56-
cp -r deploy/config-spec/* deploy/helm/trino-operator/configs;\
57+
mkdir -p "deploy/helm/${OPERATOR_NAME}/configs";\
58+
cp -r deploy/config-spec/* "deploy/helm/${OPERATOR_NAME}/configs";\
5759
fi
5860

5961
crds:
60-
mkdir -p deploy/helm/trino-operator/crds
61-
cargo run --bin stackable-trino-operator -- crd | yq eval '.metadata.annotations["helm.sh/resource-policy"]="keep"' - > deploy/helm/trino-operator/crds/crds.yaml
62+
mkdir -p deploy/helm/"${OPERATOR_NAME}"/crds
63+
cargo run --bin stackable-"${OPERATOR_NAME}" -- crd | yq eval '.metadata.annotations["helm.sh/resource-policy"]="keep"' - > "deploy/helm/${OPERATOR_NAME}/crds/crds.yaml"
6264

6365
chart-lint: compile-chart
6466
docker run -it -v $(shell pwd):/build/helm-charts -w /build/helm-charts quay.io/helmpack/chart-testing:v3.5.0 ct lint --config deploy/helm/ct.yaml
6567

66-
## Manifest related targets
67-
clean-manifests:
68-
mkdir -p deploy/manifests
69-
rm -rf $$(find deploy/manifests -maxdepth 1 -mindepth 1 -not -name Kustomization)
68+
clean: chart-clean
69+
cargo clean
70+
docker rmi --force "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}"
71+
72+
regenerate-charts: chart-clean compile-chart
7073

71-
generate-manifests: clean-manifests compile-chart
72-
./scripts/generate-manifests.sh
74+
build: regenerate-charts helm-package docker-build
7375

74-
regenerate-charts: chart-clean clean-manifests compile-chart generate-manifests
76+
publish: build docker-publish helm-publish

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<h1 align="center">Stackable Operator for Trino</h1>
66

7-
[![Build Actions Status](https://ci.stackable.tech/job/trino%2doperator%2dit%2dnightly/badge/icon?subject=Integration%20Tests)](https://ci.stackable.tech/job/trino%2doperator%2dit%2dnightly)
7+
![Build Actions Status](https://ci.stackable.tech/buildStatus/icon?job=trino%2doperator%2dit%2dnightly&subject=Integration%20Tests)
88
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/stackabletech/trino-operator/graphs/commit-activity)
99
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg)](https://docs.stackable.tech/home/stable/contributor/index.html)
1010
[![License OSL3.0](https://img.shields.io/badge/license-OSL3.0-green)](./LICENSE)

deploy/manifests/Kustomization

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)