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

Feature/97 matchmaking agent api #104

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
32 changes: 0 additions & 32 deletions .github/actions/setup-java/action.yml

This file was deleted.

49 changes: 47 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ jobs:
with:
submodules: recursive

# Setup build environment
- uses: ./.github/actions/setup-java
# Set-Up
- name: Setup JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Enable deployment access (on demand or main branch and version tags only)
- name: Login to GitHub Container Registry
Expand Down Expand Up @@ -238,3 +243,43 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USER || github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN || secrets.GITHUB_TOKEN }}
repository: ${{ steps.set-docker-repo.outputs.REPO }}/provisioning-agent

# build in any case, but push only main and version tag settings
- name: Matchmaking Container Build and Push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: matchmaking/.
file: matchmaking/src/main/docker/Dockerfile
# Build image for verification purposes on every trigger event. Only push if event is not a PR
push: ${{ ( github.event.inputs.deploy_docker == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
tags: ${{ steps.meta-remote.outputs.tags }}
labels: ${{ steps.meta-remote.outputs.labels }}

# Important step to push image description to DockerHub - since this is version independent, we always take it from main
- name: Update Docker Hub description for Matchmaking Agent
if: ${{ steps.set-docker-repo.outputs.REPO == 'docker.io' && github.ref == 'refs/heads/main' }}
uses: peter-evans/dockerhub-description@dc67fad7001ef9e8e3c124cb7a64e16d0a63d864 # v3.4.2
with:
readme-filepath: matchmaking/README.md
username: ${{ secrets.DOCKER_HUB_USER || github.actor }}
password: ${{ secrets.DOCKER_HUB_TOKEN || secrets.GITHUB_TOKEN }}
repository: ${{ steps.set-docker-repo.outputs.REPO }}/matchmaking-agent

# Create SemVer or ref tags dependent of trigger event
- name: Docker Meta Matchmaking
id: meta-match
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
${{ steps.set-docker-repo.outputs.REPO }}/provisioning-agent
# Automatically prepare image tags; See action docs for more examples.
# semver patter will generate tags like these for example :1 :1.2 :1.2.3
tags: |
type=sha,event=branch
type=sha,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=1.12.17-SNAPSHOT,enable=${{ github.event.inputs.deploy_docker == 'true' || github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}

98 changes: 98 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
###############################################################
# Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
###############################################################

name: Check Dependencies

on:
push:
branches:
- main
- 'release/*'
pull_request:
branches:
- main
- 'release/*'
types:
- opened
- synchronize
- reopened
workflow_dispatch:

jobs:
check-dependencies:

runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['7.0']

steps:

# Get the Code
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive

# Set-Up
- name: Setup JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Run Maven Deploy (on demand or if either running on main or a version tag)
- name: Generate Dependencies file
if: ${{ ( github.event.inputs.deploy_maven == 'true' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
run: |
./mvnw org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES

- name: Check if dependencies were changed
id: dependencies-changed
run: |
changed=$(git diff DEPENDENCIES)
if [[ -n "$changed" ]]; then
echo "dependencies changed"
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "dependencies not changed"
echo "changed=false" >> $GITHUB_OUTPUT
fi

- name: Check for restricted dependencies
run: |
restricted=$(grep ' restricted,' DEPENDENCIES || true)
if [[ -n "$restricted" ]]; then
echo "The following dependencies are restricted: $restricted"
exit 1
fi
if: steps.dependencies-changed.outputs.changed == 'true'

- name: Upload DEPENDENCIES file
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
path: DEPENDENCIES
if: steps.dependencies-changed.outputs.changed == 'true'

- name: Signal need to update DEPENDENCIES
run: |
echo "Dependencies need to be updated (updated DEPENDENCIES file has been uploaded to workflow run)"
exit 1
if: steps.dependencies-changed.outputs.changed == 'true'
25 changes: 23 additions & 2 deletions .github/workflows/helm-chart-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,32 @@ jobs:
lint-test:
runs-on: ubuntu-latest
steps:
# get the code
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

# Set-Up Helm
- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.10.3

- uses: ./.github/actions/setup-java
# Set-Up Java
- name: Setup JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Set-Up Python
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.9

# Set-Up CT
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

Expand Down Expand Up @@ -104,7 +114,7 @@ jobs:
# install the chart to the kind cluster and run helm test
# define charts to test with the --charts parameter
- name: Run chart-testing (install)
run: ct install --charts charts/conforming-agent,charts/provisioning-agent,charts/remoting-agent --config charts/config/chart-testing-config.yaml --helm-extra-set-args="--set=image.registry=kind-registry:5000/"
run: ct install --charts charts/conforming-agent,charts/provisioning-agent,charts/remoting-agent,charts/matchmakin-agent --config charts/config/chart-testing-config.yaml --helm-extra-set-args="--set=image.registry=kind-registry:5000/"
if: github.event_name != 'pull_request' || env.CHART_CHANGED == 'true'

# Upgrade the released chart version with the locally available chart
Expand Down Expand Up @@ -136,3 +146,14 @@ jobs:
helm dependency update charts/remoting-agent
helm upgrade remoting charts/remoting-agent
if: (github.event_name != 'pull_request' || env.CHART_CHANGED == 'true') && github.event.inputs.upgrade_from != '' && github.event.inputs.upgrade_from != 'x.x.x'

# Upgrade the released chart version with the locally available chart
# default value for event_name != workflow_dispatch
- name: Run helm upgrade on matchmaking agent
run: |
helm repo add tractusx-dev https://eclipse-tractusx.github.io/charts/dev
helm install matchmaking tractusx-dev/matchmaking-agent --version ${{ github.event.inputs.upgrade_from }} --set=image.registry=kind-registry:5000/
helm dependency update charts/matchmaking-agent
helm upgrade remoting charts/matchmaking-agent
if: (github.event_name != 'pull_request' || env.CHART_CHANGED == 'true') && github.event.inputs.upgrade_from != '' && github.event.inputs.upgrade_from != 'x.x.x'

1 change: 1 addition & 0 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
- provisioning-agent
- remoting-agent
- conforming-agent
- matchmaking-agent
steps:

# Determine the right target docker repo
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/veracode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- uses: ./.github/actions/setup-java

Check warning on line 48 in .github/workflows/veracode.yml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Unpinned Actions Full Length Commit SHA

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
- name: Verify proper formatting
run: ./mvnw spotless:check

Expand All @@ -61,11 +61,12 @@
fail-fast: false
matrix:
variant: [{dir: remoting, name: remoting-agent},
{dir: conforming, name: conforming-agent}]
{dir: conforming, name: conforming-agent},
{dir: matchmaking, name: matchmaking-agent}]
steps:
# Set-Up
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup-java

Check warning on line 69 in .github/workflows/veracode.yml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Unpinned Actions Full Length Commit SHA

Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. When selecting a SHA, you should verify it is from the action's repository and not a repository fork.
# Build
- name: Build ${{ matrix.variant.name }}
run: |-
Expand Down Expand Up @@ -106,9 +107,17 @@
matrix:
variant: [{dir: provisioning, name: provisioning-agent}]
steps:
# Set-Up
# Check-Out
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/setup-java

# Set-Up
- name: Setup JDK 17
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'

# Build
- name: Build ${{ matrix.variant.name }}
run: |-
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ logs/
.vscode
.env
__pycache__
.classpath
.project
.settings/
*.bak
*cs-cleanup.xml
*cs-formatter.xml
.checkstyle

Loading
Loading