Skip to content

Commit f0aaec8

Browse files
authored
Merge pull request #380 from mbaldessari/gh-actions-fixes
Fix gh actions and also add a local super-linter target
2 parents 99ce60f + d27c618 commit f0aaec8

5 files changed

Lines changed: 54 additions & 11 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: "Docker Build"
22
on: [push, pull_request]
33

4+
permissions:
5+
contents: read
6+
47
jobs:
58
docker-build:
69
name: Docker Build
710
runs-on: ubuntu-latest
811
steps:
912
- name: Checkout
1013
uses: actions/checkout@v5
14+
with:
15+
persist-credentials: false
1116

1217
- name: Docker Build
1318
env:

.github/workflows/go.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@ name: Go
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69

710
build:
811
runs-on: ubuntu-latest
912
steps:
10-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v5
14+
with:
15+
persist-credentials: false
1116

12-
- name: Set up Go
13-
uses: actions/setup-go@v5
14-
with:
15-
go-version-file: go.mod
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
1621

17-
- name: Build
18-
run: make build
22+
- name: Build
23+
run: make build
1924

20-
- name: Test
21-
run: make test
25+
- name: Test
26+
run: make test

.github/workflows/lint.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
name: Integration tests
22
on: [push, pull_request]
33

4+
permissions:
5+
contents: read
6+
47
jobs:
58
lint_code:
69
name: Run golangci-lint on PR
710
runs-on: ubuntu-latest
811
steps:
912
- name: Checkout code
1013
uses: actions/checkout@v5
14+
with:
15+
persist-credentials: false
1116

1217
- name: Setup go
1318
uses: actions/setup-go@v5
@@ -22,7 +27,7 @@ jobs:
2227
echo '' > "${APIFILE}"
2328
2429
- name: Run golangci-lint
25-
uses: golangci/golangci-lint-action@v8
30+
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
2631
with:
2732
version: v2.2.2
2833
args: --timeout 5m -v

.github/workflows/push-built-tag.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,29 @@ on:
55
tags:
66
- '[0-9]+.[0-9]+.[0-9]+'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build_and_push_image:
1013
name: Build and push pattern-operator image to quay.io
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v5
17+
with:
18+
persist-credentials: false
1419

20+
# We use an env due to https://docs.zizmor.sh/audits/#remediation_18
1521
- name: Check that tag version corresponds to metadata version
1622
run: |-
1723
VERSION=$(yq -r '.spec.version' bundle/manifests/patterns-operator.clusterserviceversion.yaml)
18-
TAG=${{ github.ref_name }}
24+
TAG="${ TAG_ENV }"
1925
if [ "${VERSION}" != "${TAG}" ]; then
2026
echo "Version in metadata ${VERSION} whereas tag is different: ${TAG}"
2127
exit 1
2228
fi
29+
env:
30+
TAG_ENV: ${{ github.ref_name }}
2331

2432
- name: Check that both QUAY_ROBOT_USER and QUAY_ROBOT_TOKEN exist
2533
run: |-

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,23 @@ catalog-install: config/samples/pattern-catalog-$(VERSION).yaml ## Install the O
333333
config/samples/pattern-catalog-$(VERSION).yaml:
334334
cp config/samples/pattern-catalog.yaml config/samples/pattern-catalog-$(VERSION).yaml
335335
sed -i -e "s@CATALOG_IMG@$(CATALOG_IMG)@g" config/samples/pattern-catalog-$(VERSION).yaml
336+
337+
.PHONY: super-linter
338+
super-linter: ## Runs super linter locally
339+
rm -rf .mypy_cache
340+
podman run -e RUN_LOCAL=true -e USE_FIND_ALGORITHM=true \
341+
-e VALIDATE_ANSIBLE=false \
342+
-e VALIDATE_BASH=false \
343+
-e VALIDATE_CHECKOV=false \
344+
-e VALIDATE_DOCKERFILE_HADOLINT=false \
345+
-e VALIDATE_JSCPD=false \
346+
-e VALIDATE_JSON_PRETTIER=false \
347+
-e VALIDATE_MARKDOWN_PRETTIER=false \
348+
-e VALIDATE_PYTHON_PYLINT=false \
349+
-e VALIDATE_SHELL_SHFMT=false \
350+
-e VALIDATE_YAML=false \
351+
-e VALIDATE_YAML_PRETTIER=false \
352+
$(DISABLE_LINTERS) \
353+
-v $(PWD):/tmp/lint:rw,z \
354+
-w /tmp/lint \
355+
ghcr.io/super-linter/super-linter@sha256:6c71bd17ab38ceb7acb5b93ef72f5c2288b5456a5c82693ded3ee8bb501bba7f # slim-v8.1.0

0 commit comments

Comments
 (0)