Skip to content

Commit 8f1797e

Browse files
committed
Update templated files to rev b5ebd49 (#187)
Automatically created PR based on commit b5ebd49b2ed7fbaa53ced1cce021893ce4e47c87 in stackabletech/operator-templating repo. Original commit message: Publishing Artifacts step is skipped for bors staging branches but marked as required. (#63) This keeps bors from merging any prs.
1 parent f27b4eb commit 8f1797e

33 files changed

+663
-609
lines changed

.flake8

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
ignore = E111,E501,E114

.github/dependabot.yml

-30
This file was deleted.

.github/pull_request_template.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
- [ ] Documentation added (or not applicable)
1111
- [ ] Changelog updated (or not applicable)
1212
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
13+
- [ ] Helm chart can be installed and deployed operator works (or not applicable)
1314

1415
Once the review is done, comment `bors r+` (or `bors merge`) to merge. [Further information](https://bors.tech/documentation/getting-started/#reviewing-pull-requests)

.github/workflows/build.yml

+308
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
---
2+
name: Stackable Build Pipeline
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- staging
9+
- trying
10+
- "renovate/**"
11+
tags:
12+
- "*"
13+
pull_request:
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
CARGO_INCREMENTAL: '0'
18+
CARGO_PROFILE_DEV_DEBUG: '0'
19+
RUSTFLAGS: "-D warnings"
20+
RUSTDOCFLAGS: "-D warnings"
21+
RUST_LOG: "info"
22+
PRODUCT_NAME: nifi
23+
DEV_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-dev
24+
TEST_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-test
25+
STABLE_REPO_HELM_URL: https://repo.stackable.tech/repository/helm-stable
26+
27+
jobs:
28+
# Identify unused dependencies
29+
run_udeps:
30+
name: Run Cargo Udeps
31+
runs-on: ubuntu-latest
32+
env:
33+
RUSTC_BOOTSTRAP: 1
34+
steps:
35+
- uses: actions/[email protected]
36+
- uses: actions-rs/[email protected]
37+
with:
38+
profile: minimal
39+
toolchain: stable
40+
override: true
41+
- uses: Swatinem/[email protected]
42+
with:
43+
key: udeps
44+
- uses: actions-rs/cargo@v1
45+
with:
46+
command: install
47+
args: cargo-udeps --locked
48+
- uses: actions-rs/cargo@v1
49+
with:
50+
command: udeps
51+
52+
# This job evaluates the github environment to determine why this action is running and selects the appropriate
53+
# target repository for published Helm charts based on this.
54+
#
55+
# The following scenarios are identified:
56+
# - pull request:
57+
# condition: github.event_name == "pull_request"
58+
# repository: test
59+
#
60+
# - release (aka a tag was created):
61+
# condition: github.event_name == 'create' & github.ref.startswith('refs/tags/')
62+
# repository: stable
63+
#
64+
# - merge of pr to main branch:
65+
# condition: github.event_name == 'push' & github.ref == 'refs/heads/main'
66+
# repository: dev
67+
#
68+
# Any other scenarios will cause the publish step to be skipped, most commonly this is expected to happen for the
69+
# branches that bors uses internally (staging, trying) for which the checks need to run, but we do not want artifacts
70+
# to be published.
71+
select_repo:
72+
name: Select target repository based on action trigger
73+
runs-on: ubuntu-latest
74+
outputs:
75+
repository: ${{ steps.selectrepo.outputs.repo }}
76+
steps:
77+
- id: selectrepo
78+
env:
79+
TRIGGER: ${{ github.event_name }}
80+
GITHUB_REF: ${{ github.ref }}
81+
run: |
82+
if [[ $TRIGGER == "pull_request" ]]; then
83+
echo "exporting test as target repo: ${{ env.TEST_REPO_HELM_URL }}"
84+
echo "::set-output name=repo::${{ env.TEST_REPO_HELM_URL }}"
85+
elif [[ $TRIGGER == "push" && $GITHUB_REF == "refs/heads/main" ]]; then
86+
echo "exporting dev as target repo: ${{ env.DEV_REPO_HELM_URL }}"
87+
echo "::set-output name=repo::${{ env.DEV_REPO_HELM_URL }}"
88+
elif [[ ( $TRIGGER == "create" || $TRIGGER == "push" ) && $GITHUB_REF == refs/tags/* ]]; then
89+
echo "exporting stable as target repo: ${{ env.STABLE_REPO_HELM_URL }}"
90+
echo "::set-output name=repo::${{ env.STABLE_REPO_HELM_URL }}"
91+
else
92+
echo "Unknown trigger and ref combination encountered, skipping publish step: $TRIGGER $GITHUB_REF"
93+
echo "::set-output name=repo::skip"
94+
fi
95+
96+
run_cargodeny:
97+
name: Run Cargo Deny
98+
runs-on: ubuntu-latest
99+
strategy:
100+
matrix:
101+
checks:
102+
- advisories
103+
- bans licenses sources
104+
105+
# Prevent sudden announcement of a new advisory from failing ci:
106+
continue-on-error: ${{ matrix.checks == 'advisories' }}
107+
108+
steps:
109+
- uses: actions/[email protected]
110+
- uses: EmbarkStudios/[email protected]
111+
with:
112+
command: check ${{ matrix.checks }}
113+
114+
run_rustfmt:
115+
name: Run Rustfmt
116+
runs-on: ubuntu-latest
117+
steps:
118+
- uses: actions/[email protected]
119+
- uses: actions-rs/[email protected]
120+
with:
121+
profile: minimal
122+
toolchain: stable
123+
components: rustfmt
124+
override: true
125+
- uses: actions-rs/[email protected]
126+
with:
127+
command: fmt
128+
args: --all -- --check
129+
130+
run_clippy:
131+
name: Run Clippy
132+
runs-on: ubuntu-latest
133+
steps:
134+
- uses: actions/[email protected]
135+
- uses: actions-rs/[email protected]
136+
with:
137+
profile: minimal
138+
toolchain: stable
139+
components: clippy
140+
override: true
141+
- uses: Swatinem/[email protected]
142+
with:
143+
key: clippy
144+
- name: Run clippy action to produce annotations
145+
env:
146+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
uses: actions-rs/[email protected]
148+
if: env.GITHUB_TOKEN != null
149+
with:
150+
args: --all-targets -- -D warnings
151+
token: ${{ secrets.GITHUB_TOKEN }}
152+
- name: Run clippy manually without annotations
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
if: env.GITHUB_TOKEN == null
156+
run: cargo clippy --all-targets -- -D warnings
157+
158+
run_rustdoc:
159+
name: Run RustDoc
160+
runs-on: ubuntu-latest
161+
steps:
162+
- uses: actions/[email protected]
163+
- uses: actions-rs/[email protected]
164+
with:
165+
profile: minimal
166+
toolchain: stable
167+
components: rustfmt
168+
override: true
169+
- uses: Swatinem/[email protected]
170+
with:
171+
key: doc
172+
- uses: actions-rs/[email protected]
173+
with:
174+
command: doc
175+
args: --document-private-items
176+
177+
run_tests:
178+
name: Run Cargo Tests
179+
needs:
180+
- run_cargodeny
181+
- run_clippy
182+
- run_rustfmt
183+
- run_rustdoc
184+
- run_udeps
185+
runs-on: ubuntu-latest
186+
steps:
187+
- uses: actions/[email protected]
188+
- uses: actions-rs/[email protected]
189+
with:
190+
profile: minimal
191+
toolchain: stable
192+
override: true
193+
- uses: Swatinem/[email protected]
194+
with:
195+
key: test
196+
- uses: actions-rs/[email protected]
197+
with:
198+
command: test
199+
200+
# This job cleans up the CRDs, Helm charts and Kustomize manifests, followed by rebuilding them
201+
# It then runs a `git diff` and fails the entire workflow, if any difference is encountered.
202+
#
203+
# Since CRD files are generated during the 'cargo build' process we need to run this once after
204+
# removing the CRD files to ensure that the checked in versions match what the code expects.
205+
#
206+
# The reason for this step is, that developers are expected to check in up-to-date versions of charts
207+
# and manifests, as we'd otherwise have to build these in CI and commit them back to the PR, which
208+
# creates all kinds of problems.
209+
# Therefor this failsafe simply aborts anything that has not had charts and manifests rebuilt before pushing.
210+
check_charts:
211+
name: Check if committed Helm & Kustomize Charts were up to date
212+
needs:
213+
- run_cargodeny
214+
- run_clippy
215+
- run_rustfmt
216+
- run_rustdoc
217+
runs-on: ubuntu-latest
218+
steps:
219+
- name: Checkout
220+
uses: actions/checkout@v2
221+
- name: Set up Helm
222+
uses: azure/[email protected]
223+
with:
224+
version: v3.6.2
225+
- name: Set up cargo
226+
uses: actions-rs/[email protected]
227+
with:
228+
profile: minimal
229+
toolchain: stable
230+
override: true
231+
- name: Set up rust-cache
232+
uses: Swatinem/[email protected]
233+
with:
234+
key: charts
235+
- name: Regenerate charts
236+
run: make regenerate-charts
237+
- name: Check if committed charts were up to date
238+
run: git diff --exit-code
239+
- name: Git Diff showed uncommitted changes
240+
if: ${{ failure() }}
241+
uses: actions/github-script@v3
242+
with:
243+
script: |
244+
core.setFailed('Committed charts were not up to date, please regenerate and re-commit!')
245+
246+
test_charts:
247+
name: Run Chart Tests
248+
needs:
249+
- check_charts
250+
- run_tests
251+
runs-on: ubuntu-latest
252+
steps:
253+
- name: Checkout
254+
uses: actions/checkout@v2
255+
- name: placeholder
256+
run: echo Tests will go here
257+
258+
package_and_publish:
259+
name: Package Charts, Build Docker Image and publish them
260+
needs:
261+
- test_charts
262+
- select_repo
263+
runs-on: ubuntu-latest
264+
env:
265+
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
266+
REPO: ${{ needs.select_repo.outputs.repository }}
267+
if: needs.select_repo.outputs.repository != 'skip'
268+
steps:
269+
- name: Checkout
270+
uses: actions/checkout@v2
271+
- uses: actions/setup-python@v2
272+
if: ${{ github.event_name == 'pull_request' }}
273+
- uses: actions-rs/[email protected]
274+
with:
275+
profile: minimal
276+
toolchain: stable
277+
components: rustfmt
278+
override: true
279+
- name: Install requirements for version tool
280+
if: ${{ github.event_name == 'pull_request' }}
281+
run: pip install -r python/requirements.txt
282+
283+
# This step checks if the current run was triggered by a push to a pr (or a pr being created).
284+
# If this is the case it changes the version of this project in all Cargo.toml files to include the suffix
285+
# "-pr<prnumber>" so that the published artifacts can be linked to this PR.
286+
- name: Update version if PR
287+
if: ${{ github.event_name == 'pull_request' }}
288+
run: python/cargo_version.py -m pr${{ github.event.pull_request.number }}
289+
290+
# Recreate charts with changed version if needed
291+
- name: Clean charts
292+
if: ${{ github.event_name == 'pull_request' }}
293+
run: make chart-clean clean-manifests compile-chart generate-manifests
294+
295+
# Package and publish charts
296+
- name: Package Chart
297+
run: mkdir -p target/helm && helm package --destination target/helm deploy/helm/${{ env.PRODUCT_NAME }}-operator
298+
- name: Build Docker image
299+
if: env.NEXUS_PASSWORD != null
300+
run: make docker
301+
- name: Publish Chart
302+
if: env.NEXUS_PASSWORD != null
303+
run: >-
304+
/usr/bin/curl
305+
--fail
306+
-u 'github:${{ secrets.NEXUS_PASSWORD }}'
307+
--upload-file "./$(find target/helm/ -name '*.tgz')"
308+
"${{ env.REPO }}/"

.github/workflows/pr_generate_manifests.yml

-39
This file was deleted.

0 commit comments

Comments
 (0)