From 5968e3b8f7d337f86fd0115ccc6f31ae76dfe2b9 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Thu, 20 Jun 2024 10:11:28 -0700 Subject: [PATCH 1/4] docs: add documentation to run workflows locally --- .act/pr_event.json | 5 +++++ docs/DEVELOPMENT.md | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .act/pr_event.json diff --git a/.act/pr_event.json b/.act/pr_event.json new file mode 100644 index 00000000..ded17d13 --- /dev/null +++ b/.act/pr_event.json @@ -0,0 +1,5 @@ +{ + "repository": { + "default_branch": "main" + } +} diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index ee79115c..fcb03b7e 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -223,6 +223,26 @@ docker exec -it {container-id} crictl rmi puris-backend:dev docker exec -it {container-id} crictl rmi puris-frontend:dev ``` +## Testing Workflows locally + +[act](https://github.com/nektos/act) is a tool to run jobs within `./workflows` locally. Configuration of events can +be stored in `./act` + +Install by downloading the released binaries and add them to your path. + +```shell +cd + +act --list +>> Stage Job ID Job name Workflow name Workflow file Events +>> 0 check-dependencies-backend check-dependencies-backend 3rd Party Dependency Check (Eclipse Dash Tool) dash-dependency-check.yml workflow_dispatch,pull_request +>> 0 check-dependencies-frontend check-dependencies-frontend 3rd Party Dependency Check (Eclipse Dash Tool) dash-dependency-check.yml workflow_dispatch,pull_request +>> 0 lint-test lint-test Lint and Test Charts helm-test.yml pull_request,workflow_dispatch + +# run action with job-id lint-test for event as defined in pr-event.json +act --job lint-test -e .act/pr-event.json +``` + ## NOTICE This work is licensed under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0). From 0fa30f562f5feba35d3e104b2f1cad9b463e6d08 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Thu, 20 Jun 2024 10:12:18 -0700 Subject: [PATCH 2/4] ci(helm-test): add step in the end to fail if version has not been bumped but run tests --- .github/workflows/helm-test.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/helm-test.yml b/.github/workflows/helm-test.yml index 6c5f4546..09f0e0fe 100644 --- a/.github/workflows/helm-test.yml +++ b/.github/workflows/helm-test.yml @@ -103,7 +103,7 @@ jobs: fi - name: Run chart-testing (lint) - run: ct lint --validate-maintainers=false --target-branch ${{ github.event.repository.default_branch }} + run: ct lint --validate-maintainers=false --check-version-increment=false --target-branch ${{ github.event.repository.default_branch }} - name: Run chart-testing (install) run: | @@ -126,3 +126,11 @@ jobs: helm dependency update charts/puris helm upgrade puris charts/puris if: github.event_name != 'pull_request' || steps.list-changed.outputs.changed == 'true' + + # check version increment should fail separately + # we don't directly release a chart and thus maybe don't need to increase the version. + # to enable this behaviour otterdog has been reconfigured + - name: Run chart-testing (version update) + id: version-check + run: | + ct lint --validate-maintainers=false --check-version-increment=true --target-branch ${{ github.event.repository.default_branch }} From 2304034f6eb7aaa587c7d28681d62fcbeceecf30 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Thu, 20 Jun 2024 10:17:59 -0700 Subject: [PATCH 3/4] ci: rename job names for otterdog --- .github/workflows/build-image-backend.yml | 2 +- .github/workflows/build-image-frontend.yml | 2 +- .github/workflows/codeql.yml | 2 +- .github/workflows/kics.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image-backend.yml b/.github/workflows/build-image-backend.yml index 04c271e5..55be7c5e 100644 --- a/.github/workflows/build-image-backend.yml +++ b/.github/workflows/build-image-backend.yml @@ -41,7 +41,7 @@ env: IMAGE_NAME: "app-puris-backend" jobs: - docker: + docker-backend: if: github.repository_owner == 'eclipse-tractusx' # prevent running on forks runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/build-image-frontend.yml b/.github/workflows/build-image-frontend.yml index 3c670327..d4a03971 100644 --- a/.github/workflows/build-image-frontend.yml +++ b/.github/workflows/build-image-frontend.yml @@ -45,7 +45,7 @@ env: REPOSITORY: "${{ github.repository }}" jobs: - docker: + docker-frontend: if: github.repository_owner == 'eclipse-tractusx' # prevent running on forks runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 62977247..58eb7670 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,7 +41,7 @@ on: jobs: analyze: - name: Analyze + name: Analyze CodeQl # Runner size impacts CodeQL analysis time. To learn more, please see: # - https://gh.io/recommended-hardware-resources-for-running-codeql # - https://gh.io/supported-runners-and-hardware-resources diff --git a/.github/workflows/kics.yml b/.github/workflows/kics.yml index 6efd512c..0dcb1215 100644 --- a/.github/workflows/kics.yml +++ b/.github/workflows/kics.yml @@ -39,7 +39,7 @@ on: jobs: analyze: - name: Analyze + name: Analyze KICS runs-on: ubuntu-latest permissions: actions: read From a48a72de0cb00942beeac1b8cc17d0c83a0a4500 Mon Sep 17 00:00:00 2001 From: --show-origin Date: Fri, 21 Jun 2024 04:58:12 -0700 Subject: [PATCH 4/4] chore: add template for PR to consider the helm chart change --- .github/pull_request_template.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..7f55ebf1 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,26 @@ + + +## Description + + + + +## Pre-review checks + +Please ensure to do as many of the following checks as possible, before asking for committer review: + +- [ ] DEPENDENCIES are up-to-date. [Dash license tool](https://github.com/eclipse/dash-licenses). Committers can open IP issues for restricted libs. +- [ ] [Copyright and license header](https://eclipse-tractusx.github.io/docs/release/trg-7/trg-7-02) are present on all affected files +- [ ] If helm chart has been changed, the chart version has been bumped to either next major, minor or patch level (compared to released chart).