Skip to content

Commit 38073d9

Browse files
committed
Update templated files to rev 15a76dc (#206)
Automatically created PR based on commit 15a76dc19db3c42c30187c787f2735d28774c8a1 in stackabletech/operator-templating repo. Triggered by: Manual run triggered by: soenkeliebau with message [Parameterize registry for pushing images & some updates.]
1 parent 4e557d3 commit 38073d9

File tree

10 files changed

+362
-32
lines changed

10 files changed

+362
-32
lines changed

.github/workflows/build.yml

+20-20
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ jobs:
3535
run: |
3636
sudo apt-get update
3737
sudo apt-get install protobuf-compiler
38-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
38+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
3939
with:
4040
submodules: recursive
4141
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
4242
with:
4343
profile: minimal
4444
toolchain: "1.65.0"
4545
override: true
46-
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
46+
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
4747
with:
4848
key: udeps
4949
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
@@ -111,18 +111,18 @@ jobs:
111111
continue-on-error: ${{ matrix.checks == 'advisories' }}
112112

113113
steps:
114-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
114+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
115115
with:
116116
submodules: recursive
117-
- uses: EmbarkStudios/cargo-deny-action@7257a18a9c2fe3f92b85d41ae473520dff953c97 # tag=v1.3.2
117+
- uses: EmbarkStudios/cargo-deny-action@8a8607bd8e2b3a514d5a40174cc7c55b229d9ba7 # v1.4.0
118118
with:
119119
command: check ${{ matrix.checks }}
120120

121121
run_rustfmt:
122122
name: Run Rustfmt
123123
runs-on: ubuntu-latest
124124
steps:
125-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
125+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
126126
with:
127127
submodules: recursive
128128
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
@@ -144,7 +144,7 @@ jobs:
144144
run: |
145145
sudo apt-get update
146146
sudo apt-get install protobuf-compiler
147-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
147+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
148148
with:
149149
submodules: recursive
150150
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
@@ -153,7 +153,7 @@ jobs:
153153
toolchain: "1.65.0"
154154
components: clippy
155155
override: true
156-
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
156+
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
157157
with:
158158
key: clippy
159159
- name: Run clippy action to produce annotations
@@ -178,7 +178,7 @@ jobs:
178178
run: |
179179
sudo apt-get update
180180
sudo apt-get install protobuf-compiler
181-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
181+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
182182
with:
183183
submodules: recursive
184184
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
@@ -187,7 +187,7 @@ jobs:
187187
toolchain: "1.65.0"
188188
components: rustfmt
189189
override: true
190-
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
190+
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
191191
with:
192192
key: doc
193193
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
@@ -203,15 +203,15 @@ jobs:
203203
run: |
204204
sudo apt-get update
205205
sudo apt-get install protobuf-compiler
206-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
206+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
207207
with:
208208
submodules: recursive
209209
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
210210
with:
211211
profile: minimal
212212
toolchain: "1.65.0"
213213
override: true
214-
- uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
214+
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
215215
with:
216216
key: test
217217
- uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # renovate: tag=v1.0.3
@@ -226,10 +226,10 @@ jobs:
226226
runs-on: ubuntu-latest
227227
steps:
228228
- name: Checkout
229-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
229+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
230230
with:
231231
submodules: recursive
232-
- uses: actions/setup-python@v4
232+
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
233233
with:
234234
python-version: '3.10'
235235
- name: Install jinja2-cli
@@ -240,7 +240,7 @@ jobs:
240240
run: git diff --exit-code
241241
- name: Git Diff showed uncommitted changes
242242
if: ${{ failure() }}
243-
uses: actions/github-script@d50f485531ba88479582bc2da03ff424389af5c1 # tag=v6
243+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6
244244
with:
245245
script: |
246246
core.setFailed('Committed README are not up to date, please make sure to apply them to the templated partials, and re-commit!')
@@ -264,11 +264,11 @@ jobs:
264264
sudo apt-get update
265265
sudo apt-get install protobuf-compiler
266266
- name: Checkout
267-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
267+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
268268
with:
269269
submodules: recursive
270270
- name: Set up Helm
271-
uses: azure/setup-helm@b5b231a831f96336bbfeccc1329990f0005c5bb1 # tag=v3.3
271+
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
272272
with:
273273
version: v3.6.2
274274
- name: Set up cargo
@@ -278,7 +278,7 @@ jobs:
278278
toolchain: "1.65.0"
279279
override: true
280280
- name: Set up rust-cache
281-
uses: Swatinem/rust-cache@6720f05bc48b77f96918929a9019fb2203ff71f8 # tag=v2.0.0
281+
uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
282282
with:
283283
key: charts
284284
- name: Regenerate charts
@@ -287,7 +287,7 @@ jobs:
287287
run: git diff --exit-code
288288
- name: Git Diff showed uncommitted changes
289289
if: ${{ failure() }}
290-
uses: actions/github-script@7dff1a87643417cf3b95bb10b29f4c4bc60d8ebd # tag=v6
290+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6
291291
with:
292292
script: |
293293
core.setFailed('Committed charts were not up to date, please regenerate and re-commit!')
@@ -324,10 +324,10 @@ jobs:
324324
sudo apt-get update
325325
sudo apt-get install protobuf-compiler
326326
- name: Checkout
327-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
327+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
328328
with:
329329
submodules: recursive
330-
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4
330+
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
331331
if: ${{ github.event_name == 'pull_request' }}
332332
- uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # renovate: tag=v1.0.7
333333
with:

.github/workflows/daily_security.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
audit:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
17+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
1818
- uses: actions-rs/audit-check@35b7b53b1e25b55642157ac01b4adceb5b9ebef3 # renovate: tag=v1.2.0
1919
with:
2020
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/reviewdog.yaml

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
actionlint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
17-
- uses: reviewdog/action-actionlint@fe5c2db6029881e0b5634d7cb0d119b0c16b6922 # tag=v1.32.0
16+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
17+
- uses: reviewdog/action-actionlint@b6feb003955cad286985c42e7047f4567a798f3f # v1.36.0
1818
with:
1919
github_token: ${{ secrets.GITHUB_TOKEN }}
2020

2121
flake8:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
25-
- uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4
24+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
25+
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4
2626
with:
2727
python-version: "3.9"
2828
- uses: reviewdog/action-flake8@b6435e67f0cfda225b9e0c9283cfb7ea7c551bdb # tag=v3.6.0
@@ -32,15 +32,15 @@ jobs:
3232
hadolint:
3333
runs-on: ubuntu-latest
3434
steps:
35-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
36-
- uses: reviewdog/action-hadolint@55be5d2c4b0b80d439247b128a9ded3747f92a29 # tag=v1.33.0
35+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
36+
- uses: reviewdog/action-hadolint@141ffd8d2f0b75e6fc7c87341331985448b62aa4 # v1.34.1
3737
with:
3838
github_token: ${{ secrets.GITHUB_TOKEN }}
3939

4040
markdownlint:
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
43+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
4444
- uses: reviewdog/action-markdownlint@97e3df02fe1573d505a7b268046a44fa5409cbc3 # tag=v0.9.0
4545
with:
4646
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -49,15 +49,15 @@ jobs:
4949
shellcheck:
5050
runs-on: ubuntu-latest
5151
steps:
52-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
53-
- uses: reviewdog/action-shellcheck@66c9a47bf02255b250284a82251cb4cadf5043f5 # tag=v1.15.0
52+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
53+
- uses: reviewdog/action-shellcheck@f52d78284b4941028952125a10c76676c3d456eb # v1.17.0
5454
with:
5555
github_token: ${{ secrets.GITHUB_TOKEN }}
5656

5757
yamllint:
5858
runs-on: ubuntu-latest
5959
steps:
60-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
60+
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
6161
- uses: reviewdog/action-yamllint@8c429dfe4fc47b1ce1fa99a64e94693880d5dc30 # tag=v1.6.1
6262
with:
6363
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ target/
1212
Cargo.nix
1313
crate-hashes.json
1414
result
15-
image.tar
15+
image.tar
16+
17+
tilt_options.json

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ regenerate-charts: chart-clean compile-chart
7373
build: regenerate-charts helm-package docker-build
7474

7575
publish: build docker-publish helm-publish
76+
77+
run-dev:
78+
nix run -f. tilt -- up --port 5441

Tiltfile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# If tilt_options.json exists read it and load the default_registry value from it
2+
settings = read_json('tilt_options.json', default={})
3+
registry = settings.get('default_registry', 'docker.stackable.tech/sandbox')
4+
5+
# Configure default registry either read from config file above, or with default value of "docker.stackable.tech/sandbox"
6+
default_registry(registry)
7+
8+
meta = read_json('nix/meta.json')
9+
operator_name = meta['operator']['name']
10+
11+
custom_build(
12+
registry + '/' + operator_name,
13+
'nix shell -f . crate2nix -c crate2nix generate && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load',
14+
deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'],
15+
# ignore=['result*', 'Cargo.nix', 'target', *.yaml],
16+
outputs_image_ref_to='result/ref',
17+
)
18+
19+
# Load the latest CRDs from Nix
20+
watch_file('result')
21+
if os.path.exists('result'):
22+
k8s_yaml('result/crds.yaml')
23+
24+
# Exclude stale CRDs from Helm chart, and apply the rest
25+
helm_crds, helm_non_crds = filter_yaml(
26+
helm(
27+
'deploy/helm/' + operator_name,
28+
name=operator_name,
29+
set=[
30+
'image.repository=' + registry + '/' + operator_name,
31+
],
32+
),
33+
api_version = "^apiextensions\\.k8s\\.io/.*$",
34+
kind = "^CustomResourceDefinition$",
35+
)
36+
k8s_yaml(helm_non_crds)

default.nix

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{ sources ? import ./nix/sources.nix # managed by https://github.com/nmattia/niv
2+
, nixpkgs ? sources.nixpkgs
3+
, pkgs ? import nixpkgs {}
4+
, cargo ? import ./Cargo.nix {
5+
inherit nixpkgs pkgs; release = false;
6+
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
7+
prost-build = attrs: {
8+
buildInputs = [ pkgs.protobuf ];
9+
};
10+
tonic-reflection = attrs: {
11+
buildInputs = [ pkgs.rustfmt ];
12+
};
13+
};
14+
}
15+
, meta ? pkgs.lib.importJSON ./nix/meta.json
16+
, dockerName ? "docker.stackable.tech/sandbox/${meta.operator.name}"
17+
, dockerTag ? null
18+
}:
19+
rec {
20+
build = cargo.allWorkspaceMembers;
21+
entrypoint = build+"/bin/stackable-${meta.operator.name}";
22+
crds = pkgs.runCommand "${meta.operator.name}-crds.yaml" {}
23+
''
24+
${entrypoint} crd > $out
25+
'';
26+
27+
dockerImage = pkgs.dockerTools.streamLayeredImage {
28+
name = dockerName;
29+
tag = dockerTag;
30+
contents = [ pkgs.bashInteractive pkgs.coreutils pkgs.util-linuxMinimal ];
31+
config = {
32+
Env =
33+
let
34+
fileRefVars = {
35+
PRODUCT_CONFIG = deploy/config-spec/properties.yaml;
36+
};
37+
in pkgs.lib.concatLists (pkgs.lib.mapAttrsToList (env: path: pkgs.lib.optional (pkgs.lib.pathExists path) "${env}=${path}") fileRefVars);
38+
Entrypoint = [ entrypoint ];
39+
Cmd = [ "run" ];
40+
};
41+
};
42+
docker = pkgs.linkFarm "listener-operator-docker" [
43+
{
44+
name = "load-image";
45+
path = dockerImage;
46+
}
47+
{
48+
name = "ref";
49+
path = pkgs.writeText "${dockerImage.name}-image-tag" "${dockerImage.imageName}:${dockerImage.imageTag}";
50+
}
51+
{
52+
name = "image-repo";
53+
path = pkgs.writeText "${dockerImage.name}-repo" dockerImage.imageName;
54+
}
55+
{
56+
name = "image-tag";
57+
path = pkgs.writeText "${dockerImage.name}-tag" dockerImage.imageTag;
58+
}
59+
{
60+
name = "crds.yaml";
61+
path = crds;
62+
}
63+
];
64+
65+
# need to use vendored crate2nix because of https://github.com/kolloch/crate2nix/issues/264
66+
crate2nix = import sources.crate2nix {};
67+
tilt = pkgs.tilt;
68+
}

nix/meta.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"operator": {"name": "spark-k8s-operator", "pretty_string": "Apache Spark-on-Kubernetes", "product_string": "spark-k8s", "url": "stackabletech/spark-k8s-operator.git"}}

nix/sources.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"crate2nix": {
3+
"branch": "master",
4+
"description": "nix build file generator for rust crates",
5+
"homepage": "",
6+
"owner": "kolloch",
7+
"repo": "crate2nix",
8+
"rev": "45fc83132c8c91c77a1cd61fe0c945411d1edba8",
9+
"sha256": "00w9qza56xh9m98308wzfbjf135gpz6sf7b5yfharvmax1k46c5q",
10+
"type": "tarball",
11+
"url": "https://github.com/kolloch/crate2nix/archive/45fc83132c8c91c77a1cd61fe0c945411d1edba8.tar.gz",
12+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13+
},
14+
"nixpkgs": {
15+
"branch": "nixpkgs-unstable",
16+
"description": "Nix Packages collection",
17+
"homepage": "",
18+
"owner": "NixOS",
19+
"repo": "nixpkgs",
20+
"rev": "747927516efcb5e31ba03b7ff32f61f6d47e7d87",
21+
"sha256": "1s4xabv59r99z8vd74w3r84kkxwqggqir3b0nh3ma04mni0m40gf",
22+
"type": "tarball",
23+
"url": "https://github.com/NixOS/nixpkgs/archive/747927516efcb5e31ba03b7ff32f61f6d47e7d87.tar.gz",
24+
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25+
}
26+
}

0 commit comments

Comments
 (0)