Skip to content

Commit

Permalink
Merge pull request #759 from eclipse-tractusx/revert-735-chore/222-ad…
Browse files Browse the repository at this point in the history
…opt-tractusx-as-main-repo

Revert "Chore/222 adopt tractusx as main repo"
  • Loading branch information
ds-jhartmann authored Jul 5, 2024
2 parents 4d62905 + 5b5e035 commit 9436656
Show file tree
Hide file tree
Showing 10 changed files with 137 additions and 151 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/cucumber-integration-test-DIL.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,7 @@ 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: 0 additions & 25 deletions .github/workflows/cucumber-integration-test-INT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,7 @@ 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: 2 additions & 10 deletions .github/workflows/cucumber-integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
type: string

jobs:

build:
runs-on: ubuntu-latest

Expand All @@ -41,16 +40,9 @@ 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: |
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
sed -i "s/CUCUMBER_TOKEN_IRS_PLACEHOLDER/${CUCUMBER_PUBLISH_TOKEN}/g" irs-cucumber-tests/src/test/java/org/eclipse/tractusx/irs/cucumber/RunCucumberTest.java
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: 84 additions & 0 deletions .github/workflows/int-setup-testdata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Integration testdata setup

on:
workflow_dispatch:
inputs:
testfilePath:
description: 'Path to Testdata file on GitHub'
required: true
type: string
submodelUrls:
description: 'Space-separated list of Submodel server URLs'
required: true
type: string
aasUrl:
description: 'Digital twin registry URL'
required: true
type: string
edcUrls:
description: 'Space-separated list of Provider control plane URLs'
required: true
type: string
edcApiKey:
description: 'API-Key for the provider control plane'
required: true
type: string
esrUrl:
description: 'ESR endpoint Url'
required: false
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v5
with:
python-version: 3.8 #install the python needed
cache: 'pip'
- run: pip install -r local/testing/testdata/requirements.txt

- name: Delete existing and setup new test data on provider EDC and Registry
if: ${{ github.event.inputs.esrUrl == '' }}
env:
TESTFILE_PATH: ${{ github.event.inputs.testfilePath }}
SUBMODEL_URLs: ${{ github.event.inputs.submodelUrls }}
AAS_URL: ${{ github.event.inputs.aasUrl }}
EDC_URLs: ${{ github.event.inputs.edcUrls }}
EDC_API_KEY: ${{ github.event.inputs.edcApiKey }}
run: |
python local/testing/testdata/reset-env.py \
-a $AAS_URL \
-edc $EDC_URLs \
-k $EDC_API_KEY
python local/testing/testdata/transform-and-upload.py \
-f $TESTFILE_PATH \
-s $SUBMODEL_URLs \
-a $AAS_URL \
-edc $EDC_URLs \
-k $EDC_API_KEY
- name: Delete existing and setup new test data on provider EDC and Registry
if: ${{ github.event.inputs.esrUrl != '' }}
env:
TESTFILE_PATH: ${{ github.event.inputs.testfilePath }}
SUBMODEL_URLs: ${{ github.event.inputs.submodelUrls }}
AAS_URL: ${{ github.event.inputs.aasUrl }}
EDC_URLs: ${{ github.event.inputs.edcUrls }}
EDC_API_KEY: ${{ github.event.inputs.edcApiKey }}
ESR_URL: ${{ github.event.inputs.esrUrl }}
run: |
python local/testing/testdata/reset-env.py \
-a $AAS_URL \
-edc $EDC_URLs \
-k $EDC_API_KEY
python local/testing/testdata/transform-and-upload.py \
-f $TESTFILE_PATH \
-s $SUBMODEL_URLs \
-a $AAS_URL \
-edc $EDC_URLs \
-k $EDC_API_KEY
-e $ESR_URL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: IRS smoke tests
name: IRS integration tests

on:
workflow_dispatch:
Expand Down
35 changes: 1 addition & 34 deletions .github/workflows/integration-test-DEV.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ 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 @@ -24,40 +19,12 @@ 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: ${{ github.event.inputs.executionFilter || '!Ignore & !INACTIVE & INTEGRATION_TEST & DEV' }}
executionFilter: "!Ignore & !INACTIVE & INTEGRATION_TEST & DEV"
76 changes: 48 additions & 28 deletions .github/workflows/irs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,8 @@ 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 != '' }}"

jobs:
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -56,12 +44,10 @@ jobs:
mvn clean verify --batch-mode
analyze_with_Sonar:
needs: [init]
# No need to run if we cannot use the sonar token
if: >-
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]'
(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 @@ -99,7 +85,6 @@ jobs:
-Dcheckstyle.skip -Dpmd.skip=true
build_images:
needs: [init]
strategy:
matrix:
image:
Expand Down Expand Up @@ -130,30 +115,66 @@ 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
if: needs.init.outputs.docker_hub_user != ''
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
if: env.DOCKER_HUB_USER != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

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

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

25 changes: 0 additions & 25 deletions .github/workflows/irs-load-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,7 @@ 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
Loading

0 comments on commit 9436656

Please sign in to comment.