Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Cleanup of repo (#78)
Browse files Browse the repository at this point in the history
* Cleanup of repo
Move ArgoCD parts into separate sub-folder

* Cleanup readme for helm deployment

* Remove did-helper example

* Remove IPS example

* Fix link

* Fix link

* Add lint and kubeconform

* Fix scripts permissions

* Fix eval

* Fix check job

* Fix path

* Increase helm version

* Proper error handling in eval.sh

* Add succesful text

* Add prepare-release job

* Update helm documentation

* Generate release version

* Update helm chart versions

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
dwendland and github-actions[bot] authored Jul 5, 2024
1 parent 48af164 commit a1e12e6
Show file tree
Hide file tree
Showing 63 changed files with 258 additions and 1,925 deletions.
8 changes: 8 additions & 0 deletions .github/build/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

wget "https://get.helm.sh/helm-v3.15.2-linux-amd64.tar.gz"
tar zxf helm-v3.15.2-linux-amd64.tar.gz
mkdir bin
mv linux-amd64/helm ./bin/helm

go install github.com/yannh/kubeconform/cmd/kubeconform@latest
30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,63 +8,63 @@ version: 2
# List of directories to scan for updates
updates:
- package-ecosystem: "docker"
directory: "applications/activation-service"
directory: "argocd/applications/activation-service"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/contract-management"
directory: "argocd/applications/contract-management"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/credentials-config-service"
directory: "argocd/applications/credentials-config-service"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/dsba-pdp"
directory: "argocd/applications/dsba-pdp"
schedule:
interval: "daily"
#- package-ecosystem: "docker"
# directory: "applications/keycloak"
# directory: "argocd/applications/keycloak"
# schedule:
# interval: "daily"
#- package-ecosystem: "docker"
# directory: "applications/keyrock"
# directory: "argocd/applications/keyrock"
# schedule:
# interval: "daily"
- package-ecosystem: "docker"
directory: "applications/kong"
directory: "argocd/applications/kong"
schedule:
interval: "daily"
#- package-ecosystem: "docker"
# directory: "applications/mongodb"
# directory: "argocd/applications/mongodb"
# schedule:
# interval: "daily"
#- package-ecosystem: "docker"
# directory: "applications/mysql"
# directory: "argocd/applications/mysql"
# schedule:
# interval: "daily"
- package-ecosystem: "docker"
directory: "applications/orion-ld"
directory: "argocd/applications/orion-ld"
schedule:
interval: "daily"
#- package-ecosystem: "docker"
# directory: "applications/postgres"
# directory: "argocd/applications/postgres"
# schedule:
# interval: "daily"
- package-ecosystem: "docker"
directory: "applications/tm-forum-api"
directory: "argocd/applications/tm-forum-api"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/trusted-issuers-list"
directory: "argocd/applications/trusted-issuers-list"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/vcwaltid"
directory: "argocd/applications/vcwaltid"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "applications/verifier"
directory: "argocd/applications/verifier"
schedule:
interval: "daily"

20 changes: 20 additions & 0 deletions .github/scripts/eval.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/bash

CHARTS=$(pwd)/charts/*
RETURN_VAL=0
for chart in $CHARTS
do
./bin/helm dependency build ${chart}
./bin/helm template ${chart} | kubeconform -strict

ret=$?
if [ $ret -ne 0 ]; then
RETURN_VAL=$ret
fi
done

if [ $RETURN_VAL -eq 0 ]; then
echo "Chart evaluation successful !!!"
fi

exit $RETURN_VAL
7 changes: 7 additions & 0 deletions .github/scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/bash

CHARTS=./charts/*
for chart in $CHARTS
do
docker run --rm -v $(pwd):/apps alpine/helm:2.9.0 lint $chart
done
123 changes: 122 additions & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,38 @@ on:
- main

jobs:
check:

lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Lint
run: ./.github/scripts/lint.sh

eval:
runs-on: ubuntu-latest
needs:
- lint

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v5
with:
go-version: '>=1.17.0'

- name: Eval
run: |
.github/build/install.sh
.github/scripts/eval.sh
check-labels:
runs-on: ubuntu-latest
needs:
- lint
- eval

steps:
- uses: actions/checkout@v2

Expand All @@ -38,6 +67,9 @@ jobs:

comment:
runs-on: ubuntu-latest
needs:
- "check-labels"

if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v2
Expand All @@ -50,3 +82,92 @@ jobs:
with:
message: "Please apply one of the following labels to the PR: 'patch', 'minor', 'major'."
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

prepare-release:
needs: ["check-labels", "comment"]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- id: bump
uses: zwaldowski/match-label-action@v4
with:
allowed: major,minor,patch

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]


# prepare yaml parser
- uses: actions/setup-go@v4
- name: Install yq
run: |
go install github.com/mikefarah/yq/v4@latest
yq --version
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Update versions
shell: bash
run: |
declare -A changedCharts
for file in ${{ steps.changed-files.outputs.all_changed_and_modified_files }}; do
echo "$file was changed"
baseFolder=$(cut -d'/' -f1 <<< "$file")
if [ $baseFolder = "charts" ]; then
chartName=$(cut -d'/' -f2 <<< "$file")
changedCharts[$chartName]=$chartName
fi
done
for c in "${changedCharts[@]}"; do
# get version from chart yaml
version=$(yq e '.version' "charts/$c/Chart.yaml")
major=$(cut -d'.' -f1 <<< "$version")
minor=$(cut -d'.' -f2 <<< "$version")
patch=$(cut -d'.' -f3 <<< "$version")
prType=${{ steps.bump.outputs.match }}
echo Update version $version with type $prType
if [ $prType = "major" ]; then
echo Update major
major=$((major+1))
minor=0
patch=0
elif [ $prType = "minor" ]; then
echo Update minor
minor=$((minor+1))
patch=0
elif [ $prType = "patch" ]; then
echo Update patch
patch=$((patch+1))
fi
echo Update version to $major.$minor.$patch for $c
yq e -i '.version = "'$major.$minor.$patch'"' charts/$c/Chart.yaml
done
- name: Commit files
continue-on-error: true
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git status
echo commit
git commit -m "Update helm chart versions" -a
echo status update
git status
- name: Push changes
continue-on-error: true
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ jobs:
- name: Download values for participant
run: |
cd data-space-connector/
cd argocd/data-space-connector/
wget -O values-participant.yaml ${{ env.GITOPS_REPO }}/${{ env.NAMESPACE }}/${{ matrix.participant }}/${{ env.VALUES_DIR }}/values.yaml
cat values-participant.yaml
- name: Deploy applications
run: |
cd data-space-connector/
cd argocd/data-space-connector/
helm template ${{ secrets.OVERWRITE_VALUES }} -f values-participant.yaml . | oc -n argocd apply -f -
54 changes: 52 additions & 2 deletions .github/workflows/release-helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,57 @@ on:

jobs:

deploy:
generate-version:
name: "Generate version"
runs-on: ubuntu-latest

outputs:
version: ${{ steps.out.outputs.version }}

steps:
- uses: actions/checkout@v2

- uses: actions/setup-java@v1
with:
java-version: '17'
java-package: jdk

- id: pr
uses: actions-ecosystem/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Match semver label via bash
id: match-label-bash
run: |
LABELS=$(cat <<-END
${{ steps.pr.outputs.labels }}
END
)
IFS='\n' read -ra LABEL <<< "$LABELS"
for i in "${LABEL[@]}"; do
case $i in
# Will just use the first occurence
'major'|'minor'|'patch')
echo "RELEASE_LABEL=$i" >> $GITHUB_OUTPUT
break
esac
done
- uses: zwaldowski/semver-release-action@v2
with:
dry_run: true
bump: ${{ steps.match-label-bash.outputs.RELEASE_LABEL }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Set version output
id: out
run: echo "::set-output name=version::$(echo ${VERSION})"

deploy:
name: "Release charts"
needs:
- "generate-version"
runs-on: ubuntu-latest

steps:
Expand All @@ -35,7 +84,8 @@ jobs:
CR_SKIP_EXISTING: true

git-release:
needs: ["deploy"]
name: "Create Git Release"
needs: ["generate-version", "deploy"]
runs-on: ubuntu-latest

steps:
Expand Down
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,11 @@ The chart is available at the repository ```https://fiware-ops.github.io/data-sp
structure and type of the required VCs, internal hostnames of the different connector components and providing the configuration of the DID and keys/certs.
Also have a look at the [examples](#examples).

The chart also contains the [argo-cd applications support](./data-space-connector/templates/), thus it can be used to generate argo-deployments, too. In plain Helm deployments, this should be disabled in the values.yaml:
```yaml
argoApplications: false
```
Configurations for all sub-charts(and sub-dependencies) can be managed through the top-level values.yaml of the chart. It contains the default values of each [application](./applications/). The configuration of the applications can be changed under the key ```<APPLICATION_NAME>```, please see the individual applications and there sub-charts for the available options.
Configurations for all sub-charts (and sub-dependencies) can be managed through the top-level [values.yaml](./charts/data-space-connector/values.yaml) of the chart. It contains the default values of each [application](./argocd/applications/) and additional parameter shared between the components. The configuration of the applications can be changed under the key ```<APPLICATION_NAME>```, please see the individual applications and there sub-charts for the available options.
Example:
In order to change the image-tag of [Keycloak](./applications/keycloak/) and the issuer did used by it, the values.yaml looks as following:
In order to change the image-tag of [Keycloak](./argocd/applications/keycloak/), the values.yaml looks as following:
```yaml
keycloak:
# configuration directly in the application chart, extending the original keycloak chart
didConfig:
domain: "my-new-did-domain.org"
# configuration for the keycloak-sub-chart. Its used as a dependency to the application, thus all config is accessible under the dependency name
keycloak:
image:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a1e12e6

Please sign in to comment.