Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/222 adopt tractusx as main repo #735

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
5766dde
chore(build):[#222] remove "Push image (GHCR)"
dsmf Jun 21, 2024
ca01972
Merge branch 'main' into chore/222-adopt-tractusx-as-main-repo
dsmf Jun 21, 2024
27e9923
chore(build):[#222] update documentation
dsmf Jun 24, 2024
790eef1
chore(build):[#222] analyze_with_Sonar only if tokens available
dsmf Jun 24, 2024
d938690
chore(build):[#222] fix previous commit
dsmf Jun 24, 2024
881304e
chore(build):[#222] fix previous commit
dsmf Jun 24, 2024
6013edf
chore(build):[#222] fix previous commit
dsmf Jun 24, 2024
67b1d1f
chore(build):[#222] trial to fix previous commit
dsmf Jun 24, 2024
8962323
chore(build):[#222] trial to fix previous commit
dsmf Jun 24, 2024
ca6fe1d
chore(build):[#222] trial to fix "Unrecognized named-value: 'env'"
dsmf Jun 24, 2024
8138eb2
chore(build):[#222] trial to fix "Skip output 'github_token' since it…
dsmf Jun 24, 2024
77c7447
chore(build):[#222] trial to fix previous commit
dsmf Jun 24, 2024
28b9229
chore(build):[#222] trial to fix previous commit
dsmf Jun 24, 2024
f13aa5c
chore(build):[#222] fixes / improvements
dsmf Jun 24, 2024
af59c31
chore(build):[#222] add debug output
dsmf Jun 25, 2024
c3f67af
chore(build):[#222] add debug output
dsmf Jun 25, 2024
9c08e48
chore(build):[#222] trial to fix boolean
dsmf Jun 25, 2024
0046243
chore(build):[#222] trial to fix / debug
dsmf Jun 25, 2024
86d82f9
chore(build):[#222] trial to fix / debug
dsmf Jun 25, 2024
6ccb3c1
chore(build):[#222] cleanup
dsmf Jun 25, 2024
c6eebfd
chore(build):[#222] cleanup
dsmf Jun 25, 2024
2c6c81b
Merge branch 'main' into chore/222-adopt-tractusx-as-main-repo
dsmf Jun 25, 2024
d5534ca
chore(build):[#222] cleanup
dsmf Jun 25, 2024
80307b2
chore(build):[#222] do not push image in pull requests
dsmf Jun 25, 2024
971f725
chore(build):[#222] add message if secrets not defined
dsmf Jun 26, 2024
37246b4
chore(build):[#222] add message if secrets not defined
dsmf Jun 26, 2024
f632f7d
chore(build):[#222] add message if secrets not defined
dsmf Jun 26, 2024
f2cfb8a
chore(build):[#222] add message if secrets not defined
dsmf Jun 26, 2024
df80db2
chore(build):[#222] add message if secrets not defined
dsmf Jun 26, 2024
eea4be1
chore(build):[#222] allow additonal execution filter on DEV
dsmf Jun 26, 2024
a89cb78
chore(build):[#222] allow additonal execution filter on DEV
dsmf Jun 26, 2024
d7b254f
chore(build):[#222] trial to make publishing cucumber report optional
dsmf Jun 26, 2024
b627e15
chore(build):[#222] undo does not seem to work
dsmf Jun 26, 2024
ef5e88c
chore(build):[#222] cumcumber publish token is mandatory (currently)
dsmf Jun 26, 2024
2997b88
chore(build):[#222] cleanup
dsmf Jun 26, 2024
21e4405
chore(build):[#222] simplify
dsmf Jun 26, 2024
b115727
chore(build):[#222] try to make publish optional
dsmf Jun 26, 2024
6393ba4
chore(build):[#222] try to make publish optional
dsmf Jun 26, 2024
2dd0688
chore(build):[#222] revert trial to make publish optional (does not w…
dsmf Jun 26, 2024
6f5dbf4
chore(build):[#222] rename int-test-automation.yml to smoketest.yml
dsmf Jun 26, 2024
19fc5a3
chore(build):[#222] check for missing secrets in irs-load-test.yaml
dsmf Jun 26, 2024
ba499ee
chore(build):[#222] check that releases are created on Tractus-X only
dsmf Jun 26, 2024
aa2c281
Revert "chore(build):[#222] check that releases are created on Tractu…
dsmf Jun 27, 2024
4d0e4ad
chore(build):[#222] delete outdated workflow script int-setup-testdat…
dsmf Jun 27, 2024
252ff3d
Merge branch 'main' into chore/222-adopt-tractusx-as-main-repo
dsmf Jun 27, 2024
b38a072
chore(owasp):[#222] allow triggering OWASP workflow manually
dsmf Jun 27, 2024
46733a1
chore(github-actions): [#222] cucumber integration test DEV - fix def…
dsmf Jul 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/cucumber-integration-test-DIL.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@ concurrency:
cancel-in-progress: true

jobs:

check-config:
runs-on: ubuntu-latest
steps:
- name: Check if DIL_REGULAR_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.DIL_REGULAR_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure DIL_REGULAR_USER_API_KEY."
exit 1
fi
- name: Check if DIL_ADMIN_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.DIL_ADMIN_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure DIL_ADMIN_USER_API_KEY."
exit 1
fi
- name: Check if IRS_CUCUMBER_PUBLISH_TOKEN is defined
run: |
if [[ -z "${{ secrets.IRS_CUCUMBER_PUBLISH_TOKEN }}" ]]; then
echo "Error: Missing secret: Please configure IRS_CUCUMBER_PUBLISH_TOKEN."
exit 1
fi
shell: bash

trigger-integration-test:
needs: check-config
uses: ./.github/workflows/cucumber-integration-test.yaml
secrets:
regularUserApiKey: ${{ secrets.DIL_REGULAR_USER_API_KEY }}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/cucumber-integration-test-INT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@ concurrency:
cancel-in-progress: true

jobs:

check-config:
runs-on: ubuntu-latest
steps:
- name: Check if INT_REGULAR_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.INT_REGULAR_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure INT_REGULAR_USER_API_KEY."
exit 1
fi
- name: Check if INT_ADMIN_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.INT_ADMIN_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure INT_ADMIN_USER_API_KEY."
exit 1
fi
- name: Check if IRS_CUCUMBER_PUBLISH_TOKEN is defined
run: |
if [[ -z "${{ secrets.IRS_CUCUMBER_PUBLISH_TOKEN }}" ]]; then
echo "Error: Missing secret: Please configure IRS_CUCUMBER_PUBLISH_TOKEN."
exit 1
fi
shell: bash

trigger-integration-test:
needs: check-config
uses: ./.github/workflows/cucumber-integration-test.yaml
secrets:
regularUserApiKey: ${{ secrets.INT_REGULAR_USER_API_KEY }}
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/cucumber-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
type: string

jobs:

build:
runs-on: ubuntu-latest

Expand All @@ -40,9 +41,16 @@ jobs:
ADMIN_USER_API_KEY: ${{ secrets.adminUserApiKey }}
ISSUE_FILTER: ${{ inputs.executionFilter }}
CUCUMBER_PUBLISH_TOKEN: ${{ secrets.cucumberPublishToken }}
# workaround replacement since injecting the token via environment variable does not work
run: |
sed -i "s/CUCUMBER_TOKEN_IRS_PLACEHOLDER/${CUCUMBER_PUBLISH_TOKEN}/g" irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
if [ -z "${{ secrets.cucumberPublishToken }}" ]; then
echo "Publish cucumber report disabled"
sed -i "s/PUBLISH_ENABLED_FLAG/false/g" irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
else
echo "Publish cucumber report enabled"
sed -i "s/PUBLISH_ENABLED_FLAG/true/g" irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
# workaround replacement since injecting the token via environment variable does not work
sed -i "s/CUCUMBER_TOKEN_IRS_PLACEHOLDER/${CUCUMBER_PUBLISH_TOKEN}/g" irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
fi

mvn clean verify -P cucumber -Dgroups="$ISSUE_FILTER" -pl irs-cucumber-tests -am --batch-mode 2> irs-cucumber-tests/report-banner.txt

Expand Down
84 changes: 0 additions & 84 deletions .github/workflows/int-setup-testdata.yml

This file was deleted.

35 changes: 34 additions & 1 deletion .github/workflows/integration-test-DEV.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: IRS DEV Cucumber Integration test execution

on:
workflow_dispatch: # Trigger manually
inputs:
executionFilter:
description: 'Execution filter'
required: false
default: '!Ignore & !INACTIVE & INTEGRATION_TEST & DEV'
push:
branches:
- 'main'
Expand All @@ -19,12 +24,40 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true




jobs:

check-config:
runs-on: ubuntu-latest
steps:
- name: Check if DEV_REGULAR_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.DEV_REGULAR_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure DEV_REGULAR_USER_API_KEY."
exit 1
fi
- name: Check if DEV_ADMIN_USER_API_KEY is defined
run: |
if [[ -z "${{ secrets.DEV_ADMIN_USER_API_KEY }}" ]]; then
echo "Error: Missing secret: Please configure DEV_ADMIN_USER_API_KEY."
exit 1
fi
- name: Check if IRS_CUCUMBER_PUBLISH_TOKEN is defined
run: |
if [[ -z "${{ secrets.IRS_CUCUMBER_PUBLISH_TOKEN }}" ]]; then
echo "Error: Missing secret: Please configure IRS_CUCUMBER_PUBLISH_TOKEN."
exit 1
fi
shell: bash

trigger-integration-test:
needs: check-config
uses: ./.github/workflows/cucumber-integration-test.yaml
secrets:
regularUserApiKey: ${{ secrets.DEV_REGULAR_USER_API_KEY }}
adminUserApiKey: ${{ secrets.DEV_ADMIN_USER_API_KEY }}
cucumberPublishToken: ${{ secrets.IRS_CUCUMBER_PUBLISH_TOKEN }}
with:
executionFilter: "!Ignore & !INACTIVE & INTEGRATION_TEST & DEV"
executionFilter: ${{ github.event.inputs.executionFilter || '!Ignore & !INACTIVE & INTEGRATION_TEST & DEV' }}
76 changes: 28 additions & 48 deletions .github/workflows/irs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,20 @@ on:
tags:
- '**'


jobs:
init:
runs-on: ubuntu-latest
outputs:
image_namespace: tractusx
image_name: irs-api
docker_hub_user: ${{ secrets.DOCKER_HUB_USER }}
# In order to skip sonar if not configured
sonar_configured: ${{ secrets.SONAR_TOKEN != '' && secrets.SONAR_PROJECT_KEY != '' && secrets.SONAR_ORGANIZATION != '' }}
steps:
- run: |
echo "Preparing variables"
echo "sonar_configured: ${{ secrets.SONAR_TOKEN != '' && secrets.SONAR_PROJECT_KEY != '' && secrets.SONAR_ORGANIZATION != '' }}"

build:
runs-on: ubuntu-latest
steps:
Expand All @@ -44,10 +56,12 @@ jobs:
mvn clean verify --batch-mode

analyze_with_Sonar:
needs: [init]
# No need to run if we cannot use the sonar token
if: >-
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
github.actor != 'dependabot[bot]'
needs.init.outputs.sonar_configured == 'true'
&& (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
&& github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -85,6 +99,7 @@ jobs:
-Dcheckstyle.skip -Dpmd.skip=true

build_images:
needs: [init]
strategy:
matrix:
image:
Expand Down Expand Up @@ -115,66 +130,30 @@ jobs:
echo VERSION=$VERSION
echo "::set-output name=image_tag::$VERSION"

- name: Log in to registry
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: >-
env.DOCKER_HUB_USER == '' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
github.actor != 'dependabot[bot]'
# This is where you will update the PAT to GITHUB_TOKEN
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image (GHCR)
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: >-
env.DOCKER_HUB_USER == '' &&
(github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) &&
github.actor != 'dependabot[bot]'
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
echo IMAGE_ID=$IMAGE_ID

docker tag ${{ matrix.image }} $IMAGE_ID:${{ steps.version.outputs.image_tag }}
docker push $IMAGE_ID:${{ steps.version.outputs.image_tag }}

docker tag ${{ matrix.image }} $IMAGE_ID:$GITHUB_SHA
docker push $IMAGE_ID:$GITHUB_SHA

- name: Login to Docker Hub
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER != ''
if: needs.init.outputs.docker_hub_user != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Push image (DockerHub)
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
IMAGE_NAMESPACE: tractusx
IMAGE_NAME: irs-api
if: env.DOCKER_HUB_USER != ''
if: needs.init.outputs.docker_hub_user != '' && github.event_name != 'pull_request'
run: |
docker tag ${{ matrix.image }} ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.image_tag }}
docker push ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.image_tag }}
docker tag ${{ matrix.image }} ${{ needs.init.outputs.image_namespace }}/${{ needs.init.outputs.image_name }}:${{ steps.version.outputs.image_tag }}
docker push ${{ needs.init.outputs.image_namespace }}/${{ needs.init.outputs.image_name }}:${{ steps.version.outputs.image_tag }}

docker tag ${{ matrix.image }} $IMAGE_ID:$GITHUB_SHA
docker push $IMAGE_ID:$GITHUB_SHA

# https://github.com/peter-evans/dockerhub-description
- name: Update Docker Hub description
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
IMAGE_NAMESPACE: tractusx
IMAGE_NAME: irs-api
if: env.DOCKER_HUB_USER != '' && github.event_name != 'pull_request'
if: needs.init.outputs.docker_hub_user != '' && github.event_name != 'pull_request'
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}
repository: ${{ needs.init.outputs.image_namespace }}/${{ needs.init.outputs.image_name }}
readme-filepath: ./DOCKER_NOTICE.md

trigger-trivy-image-scan:
Expand All @@ -183,3 +162,4 @@ jobs:
needs:
- build_images
uses: ./.github/workflows/trivy-docker-hub-scan.yml

25 changes: 25 additions & 0 deletions .github/workflows/irs-load-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,32 @@ on:
required: false

jobs:

check-config:
runs-on: ubuntu-latest
steps:
- name: Check if OAUTH2_CLIENT_TOKEN_URI is defined
run: |
if [[ -z "${{ secrets.OAUTH2_CLIENT_TOKEN_URI }}" ]]; then
echo "Error: Missing secret: Please configure OAUTH2_CLIENT_TOKEN_URI."
exit 1
fi
- name: Check if OAUTH2_CLIENT_SECRET is defined
run: |
if [[ -z "${{ secrets.OAUTH2_CLIENT_SECRET }}" ]]; then
echo "Error: Missing secret: Please configure OAUTH2_CLIENT_SECRET."
exit 1
fi
- name: Check if OAUTH2_CLIENT_ID is defined
run: |
if [[ -z "${{ secrets.OAUTH2_CLIENT_ID }}" ]]; then
echo "Error: Missing secret: Please configure OAUTH2_CLIENT_ID."
exit 1
fi
shell: bash

gatling-test:
needs: check-config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/owasp.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "OWASP dependency scanner"

on:
workflow_dispatch: # Additionally allow to trigger manually

push:
branches: main
paths-ignore:
Expand Down
Loading
Loading