Skip to content

Commit 0b84c0d

Browse files
Merge branch 'main' into dependabot/github_actions/super-linter/super-linter-8
2 parents d1c61fe + 01b4ded commit 0b84c0d

23 files changed

+235
-183
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @dvviktordelev
1+
* @dvviktordelev @puehringer

.github/actions/build-node-python/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ inputs:
8585
run_python_build:
8686
default: true
8787
required: false
88+
# Rust
89+
enable_rust:
90+
description: "enables the rust part of the action"
91+
default: false
92+
required: true
8893

8994
runs:
9095
using: "composite"
@@ -125,6 +130,29 @@ runs:
125130
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
126131
sudo apt-get install postgresql-16-pgvector -y
127132
shell: bash
133+
# Rust
134+
- name: Install Rust
135+
if: inputs.enable_rust == 'true'
136+
run: |
137+
if ! command -v rustup &> /dev/null ; then
138+
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused -fsSL "https://sh.rustup.rs" | sh -s -- --default-toolchain stable -y
139+
140+
# Resolve the correct CARGO_HOME path depending on OS
141+
if [[ "$RUNNER_OS" == "Windows" ]]; then
142+
echo "${CARGO_HOME:-$USERPROFILE/.cargo}/bin" | sed 's|/|\\|g' >> $GITHUB_PATH
143+
else
144+
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
145+
fi
146+
# Load cargo environment so cargo and rustc are available in this shell
147+
. "$HOME/.cargo/env"
148+
fi
149+
150+
# Ensure stable rust toolchain is installed
151+
rustup install stable
152+
153+
rustc --version
154+
cargo --version
155+
shell: bash
128156
# General
129157
- name: Git config
130158
if: inputs.github_ro_token != ''

.github/workflows/build-docker-artifacts-config.schema.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@
3535
"type": "string",
3636
"description": "ECR repository to push the image to"
3737
},
38-
"skip_image_scan": {
39-
"type": "boolean",
40-
"default": false,
41-
"description": "[Deprecated: use scan_high_severity or the .trivyignore file instead] Skip scanning the image for vulnerabilities"
42-
},
4338
"scan_high_severity": {
4439
"type": "boolean",
4540
"default": true,
4641
"description": "Scan the image for high severity vulnerabilities"
42+
},
43+
"build_args": {
44+
"type": "object",
45+
"description": "Build arguments to pass to Docker",
46+
"additionalProperties": {
47+
"type": "string"
48+
}
4749
}
4850
},
4951
"required": ["directory", "ecr_repository"]

.github/workflows/build-docker-artifacts-push.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ jobs:
4646

4747
steps:
4848
- name: Checkout repository (must be run in infrastructure-k8s)
49-
uses: actions/checkout@v4
49+
uses: actions/checkout@v5
5050
with:
5151
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
5252

5353
- name: Checkout github-workflows repository
54-
uses: actions/checkout@v4
54+
uses: actions/checkout@v5
5555
with:
5656
repository: datavisyn/github-workflows
5757
ref: ${{ env.WORKFLOW_BRANCH }}

.github/workflows/build-docker-artifacts-trigger-push.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
branch:
1212
type: string
1313
required: false
14-
# When using github.ref || github.head_ref, it would contain the full path, including /, which breaks the postgres hostname
15-
default: ${{ github.sha }}
1614
runs_on:
1715
type: string
1816
required: false
@@ -45,13 +43,13 @@ jobs:
4543

4644
steps:
4745
- name: Checkout repository
48-
uses: actions/checkout@v4
46+
uses: actions/checkout@v5
4947
with:
50-
ref: ${{ inputs.branch }}
48+
ref: ${{ inputs.branch || github.sha }}
5149
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
5250

5351
- name: Checkout github-workflows repository
54-
uses: actions/checkout@v4
52+
uses: actions/checkout@v5
5553
with:
5654
repository: datavisyn/github-workflows
5755
ref: ${{ env.WORKFLOW_BRANCH }}

.github/workflows/build-docker-artifacts.yml

Lines changed: 31 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,14 @@ on:
1616
branch:
1717
type: string
1818
required: false
19-
# When using github.ref || github.head_ref, it would contain the full path, including /, which breaks the postgres hostname
20-
default: ${{ github.sha }}
21-
fail_fast:
19+
skip_push:
2220
type: boolean
2321
required: false
24-
default: true
25-
skip_image_scan:
22+
default: false
23+
fail_fast:
2624
type: boolean
2725
required: false
28-
default: false
26+
default: true
2927
scan_high_severity:
3028
description: 'Include high severity'
3129
type: boolean
@@ -48,7 +46,7 @@ concurrency:
4846

4947
env:
5048
WORKFLOW_BRANCH: "main"
51-
PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye"
49+
PYTHON_BASE_IMAGE: "python:3.10.18-slim-bullseye"
5250
DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main"
5351
NODE_BASE_IMAGE: "node:20.9-bullseye"
5452
DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main"
@@ -67,13 +65,13 @@ jobs:
6765
runs-on: 'ubuntu-22.04'
6866
steps:
6967
- name: Checkout repository
70-
uses: actions/checkout@v4
68+
uses: actions/checkout@v5
7169
with:
72-
ref: ${{ inputs.branch }}
70+
ref: ${{ inputs.branch || github.sha }}
7371
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
7472

7573
- name: Checkout github-workflows repository
76-
uses: actions/checkout@v4
74+
uses: actions/checkout@v5
7775
with:
7876
repository: datavisyn/github-workflows
7977
ref: ${{ env.WORKFLOW_BRANCH }}
@@ -116,6 +114,10 @@ jobs:
116114
image_tag_branch_name: imageTagBranchName,
117115
ecr_respositories: flavor.components.map(component => component.ecr_repository),
118116
components: flavor.components.map(component => {
117+
// Format build arguments as build-args string
118+
const formattedBuildArgs = component.build_args ?
119+
Object.entries(component.build_args).map(([key, value]) => `${key}=${value}`).join('\n') : '';
120+
119121
return {
120122
...component,
121123
// Add metadata to the component object (will be used as matrix input),
@@ -125,6 +127,7 @@ jobs:
125127
build_time: buildTime,
126128
image_tag: imageTag,
127129
image_tag_branch_name: imageTagBranchName,
130+
formatted_build_args: formattedBuildArgs,
128131
};
129132
}),
130133
};
@@ -163,15 +166,15 @@ jobs:
163166
sudo rm -rf /opt/ghc
164167
# TODO: Support arbitrary repositories, not just the current one?
165168
- name: Checkout repository
166-
uses: actions/checkout@v4
169+
uses: actions/checkout@v5
167170
with:
168-
ref: ${{ inputs.branch }}
171+
ref: ${{ inputs.branch || github.sha }}
169172
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
170173
# This is required such that yarn install can access private repositories, i.e. visyn_pro
171174
# https://github.com/yarnpkg/yarn/issues/2614#issuecomment-2148174789
172175
persist-credentials: false
173176
- name: Checkout github-workflows repository
174-
uses: actions/checkout@v4
177+
uses: actions/checkout@v5
175178
with:
176179
repository: datavisyn/github-workflows
177180
ref: ${{ env.WORKFLOW_BRANCH }}
@@ -217,12 +220,15 @@ jobs:
217220
load: true
218221
# Disable provenance as it creates weird multi-arch images: https://github.com/docker/build-push-action/issues/755
219222
provenance: false
223+
# Disable the cache to avoid outdated (base) images
224+
no-cache: true
220225
build-args: |
221226
DOCKERFILE_DIRECTORY=${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}
222227
PYTHON_BASE_IMAGE=${{ env.PYTHON_BASE_IMAGE }}
223228
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
224229
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
225230
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
231+
${{ matrix.component.formatted_build_args }}
226232
secrets:
227233
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
228234
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"
@@ -256,10 +262,11 @@ jobs:
256262
echo "severity=HIGH,CRITICAL" >> "$GITHUB_OUTPUT"
257263
fi
258264
- name: Run Trivy vulnerability scanner
259-
if: ${{ inputs.skip_image_scan != true && fromJson(vars.SKIP_IMAGE_SCAN || 'false') != true && matrix.component.skip_image_scan != true }}
260-
uses: aquasecurity/[email protected]
265+
uses: aquasecurity/[email protected]
261266
with:
262267
image-ref: ${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
268+
# Disable scanning the current directory (defaults to .)
269+
scan-ref: '/dev/null'
263270
format: 'table'
264271
exit-code: '1'
265272
ignore-unfixed: false
@@ -268,38 +275,9 @@ jobs:
268275
continue-on-error: false
269276

270277
- name: Push image
271-
uses: docker/build-push-action@v6
272-
with:
273-
context: .
274-
file: ${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}/Dockerfile
275-
push: true
276-
# Disable provenance as it creates weird multi-arch images: https://github.com/docker/build-push-action/issues/755
277-
provenance: false
278-
# Duplicated the build-args, secrets, tags and labels from the actual build above
279-
# TODO: How can we avoid the build here and just push with this action?
280-
build-args: |
281-
DOCKERFILE_DIRECTORY=${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}
282-
PYTHON_BASE_IMAGE=${{ env.PYTHON_BASE_IMAGE }}
283-
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
284-
NODE_BASE_IMAGE=${{ env.NODE_BASE_IMAGE }}
285-
DATAVISYN_NGINX_BASE_IMAGE=${{ env.DATAVISYN_NGINX_BASE_IMAGE }}
286-
secrets:
287-
# Mount the token as secret mount: https://docs.docker.com/build/ci/github-actions/secrets/#secret-mounts
288-
"github_token=${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}"
289-
# TODO: As soon as we only have a single tag, we can push the same image to multiple repositories: https://docs.docker.com/build/ci/github-actions/push-multi-registries/
290-
# This will be useful for the images which don't change between flavors, e.g. the backend images
291-
tags: |
292-
${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
293-
labels: |
294-
name=${{ matrix.component.ecr_repository }}
295-
version=${{ matrix.component.image_tag_branch_name }}
296-
org.opencontainers.image.description=Image for ${{ matrix.component.ecr_repository }}
297-
org.opencontainers.image.source=${{ github.event.repository.html_url }}
298-
org.opencontainers.image.url=${{ github.event.repository.html_url }}
299-
org.opencontainers.image.title=${{ matrix.component.ecr_repository }}
300-
org.opencontainers.image.version=${{ matrix.component.image_tag_branch_name }}
301-
org.opencontainers.image.created=${{ matrix.component.build_time }}
302-
org.opencontainers.image.revision=${{ github.sha }}
278+
if: ${{ inputs.skip_push != true }}
279+
# Instead of the docker/build-push-action@v6 which will rebuild the image, just push it directly
280+
run: docker push ${{ vars.DV_AWS_ECR_REGISTRY }}/${{ matrix.component.ecr_repository }}:${{ matrix.component.image_tag }}
303281

304282
- name: Log out from Amazon ECR
305283
shell: bash
@@ -308,6 +286,7 @@ jobs:
308286
retag-images:
309287
name: Retag images of flavor ${{ matrix.flavor || 'default' }}
310288
needs: [get-flavors, build-flavors]
289+
if: ${{ inputs.skip_push != true }}
311290
strategy:
312291
fail-fast: false
313292
matrix:
@@ -317,13 +296,13 @@ jobs:
317296
runs-on: 'ubuntu-22.04'
318297
steps:
319298
- name: Checkout repository
320-
uses: actions/checkout@v4
299+
uses: actions/checkout@v5
321300
with:
322-
ref: ${{ inputs.branch }}
301+
ref: ${{ inputs.branch || github.sha }}
323302
token: ${{ secrets.CHECKOUT_TOKEN || github.event.repository.private == true && secrets.DATAVISYN_BOT_REPO_TOKEN || github.token }}
324303

325304
- name: Checkout github-workflows repository
326-
uses: actions/checkout@v4
305+
uses: actions/checkout@v5
327306
with:
328307
repository: datavisyn/github-workflows
329308
ref: ${{ env.WORKFLOW_BRANCH }}
@@ -367,12 +346,12 @@ jobs:
367346
push-to-repositories:
368347
name: Push images to push targets
369348
# if? When should we do this? Always? Only for certain branches? If so, how should we define that, in the config.json?
370-
if: ${{ fromJson(needs.get-flavors.outputs.result).push_to != '' }}
349+
if: ${{ inputs.skip_push != true && fromJson(needs.get-flavors.outputs.result).push_to != '' }}
371350
needs: [retag-images, get-flavors]
372351
uses: datavisyn/github-workflows/.github/workflows/build-docker-artifacts-trigger-push.yml@main
373352
secrets: inherit
374353
with:
375354
push_to: ${{ fromJson(needs.get-flavors.outputs.result).push_to }}
376-
branch: ${{ inputs.branch }}
355+
branch: ${{ inputs.branch || github.sha }}
377356
# Do not run this on self-hosted, as it is faster and shouldn't be blocking anything
378357
# runs_on: ${{ inputs.runs_on || 'ubuntu-22.04' }}

0 commit comments

Comments
 (0)