Skip to content

Commit

Permalink
Merge branch 'master' into feat/add-merchant-registry-helms
Browse files Browse the repository at this point in the history
  • Loading branch information
elnyry-sam-k authored Feb 9, 2024
2 parents ac3e6d0 + 9dd5d0a commit 9a6f7ed
Show file tree
Hide file tree
Showing 129 changed files with 7,766 additions and 1,031 deletions.
249 changes: 249 additions & 0 deletions .github/workflows/create-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
# NOTES:
# - GitHub Actions must be explicitly allowed to create pull requests in this repository.
# This setting can be found in the repository's settings under Actions > General > Workflow permissions.
# - A repository secret `AUTO_RELEASE_TOKEN` (permissions: `contents: write`, `pull-requests: write`, `repositories: read`) needs to be created.
# The secret should contain a github access token with the permissions specified above.
# The secret is used by the `create-pull-request` action to create the pull request and `updatecli` to access all updateable repositories.
# The secret can be created at https://github.com/mojaloop/helm/settings/secrets/actions

name: Create Release PR

on:
workflow_dispatch:
inputs:
branch:
type: string
description: "Branch to create release PR from (e.g. master)"
required: false
default: "master"
release_name:
type: string
description: "Release name (e.g. Acacia)"
required: false
release_version:
type: string
description: "Release version (e.g. v1.0.0)"
required: false
last_release_tag:
type: string
description: "Last release tag (e.g. v1.0.0)"
required: false
example_backend_version:
type: string
description: "Example backend version (e.g. v1.0.0)"
required: true
default: "v15.0.0"
deployment_release_name:
type: string
description: "Deployment release name (e.g. moja1)"
required: true
default: "moja2"
deployment_namespace:
type: string
description: "Deployment namespace (e.g. moja1)"
required: true
default: "moja2"
deployment_values_file:
type: string
description: "Deployment values file in oss-core-env repo"
required: true
default: "helm-values-moja2-mojaloop-v15.3.0.yaml"

jobs:
create_release_pr:
name: Create Release PR
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }}
AWS_DEFAULT_OUTPUT: ${{ vars.AWS_DEFAULT_OUTPUT }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.13.3

- name: Install dependencies
run: |
# Install mo
curl -sL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o /usr/local/bin/mo
chmod +x /usr/local/bin/mo
# Install updatecli
curl -sL https://github.com/updatecli/updatecli/releases/download/v0.71.0/updatecli_amd64.deb -o /tmp/updatecli_amd64.deb
sudo apt install /tmp/updatecli_amd64.deb
# Install jq
sudo apt-get install jq
- name: Setup Helm repositories
run: |
helm repo add stable https://charts.helm.sh/stable
helm repo add incubator https://charts.helm.sh/incubator
helm repo add kiwigrid https://kiwigrid.github.io
helm repo add kokuwa https://kokuwaio.github.io/helm-charts
helm repo add elastic https://helm.elastic.co
helm repo add codecentric https://codecentric.github.io/helm-charts
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add mojaloop-charts https://mojaloop.github.io/charts/repo
helm repo add redpanda https://charts.redpanda.com
helm repo add mojaloop https://mojaloop.io/helm/repo/
helm repo update
- name: Update chart dependencies
env:
AUTO_RELEASE_TOKEN: ${{ secrets.AUTO_RELEASE_TOKEN }}
run: .github/workflows/scripts/update-charts.sh

- name: Generate changelog
env:
AUTO_RELEASE_TOKEN: ${{ secrets.AUTO_RELEASE_TOKEN }}
run: .github/workflows/scripts/generate-changelog.sh ${{ inputs.last_release_tag }}

- name: Determine release version number
id: determine-release-version
env:
_RELEASE_VERSION: ${{ inputs.release_version }}
run: |
if [[ -z $_RELEASE_VERSION ]]; then
release_version=$(.github/workflows/scripts/determine-release-version.sh '${{ inputs.last_release_tag }}')
echo "release_version=$release_version"
echo "RELEASE_VERSION=$(echo $release_version)" >> "$GITHUB_OUTPUT"
else
echo "RELEASE_VERSION=$(echo $_RELEASE_VERSION)" >> "$GITHUB_OUTPUT"
fi
- name: Next release version
run: |
release_version='${{ steps.determine-release-version.outputs.RELEASE_VERSION }}'
if [[ -z "$release_version" || ! "$release_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "RELEASE_VERSION is not set or is not a valid semver version"
exit 1
fi
- name: Prepare TTK test cases release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.AUTO_RELEASE_TOKEN }}
repo: testing-toolkit-test-cases
makeLatest: true
allowUpdates: false
generateReleaseNotes: true
skipIfReleaseExists: true
tag: ${{ steps.determine-release-version.outputs.RELEASE_VERSION }}
commit: master

- name: Update TTK test cases version
env:
AUTO_RELEASE_TOKEN: ${{ secrets.AUTO_RELEASE_TOKEN }}
run: updatecli apply --config .github/workflows/manifests/third-pass/mojaloop.yaml

- name: Syncronize release version with mojaloop chart version
env:
AUTO_RELEASE_TOKEN: ${{ secrets.AUTO_RELEASE_TOKEN }}
run: |
release_version='${{ steps.determine-release-version.outputs.RELEASE_VERSION }}'
if [[ -z "$release_version" || ! "$release_version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "RELEASE_VERSION is not set or is not a valid semver version"
exit 1
fi
release_version="${release_version:1}"
sed -i "s/^version:.*/version: $release_version/" mojaloop/Chart.yaml
awk -v release_version="$release_version" '/^version:/ {print "version: " release_version; next} 1' mojaloop/Chart.yaml > mojaloop/Chart.yaml.tmp && mv mojaloop/Chart.yaml.tmp mojaloop/Chart.yaml
- name: Generate release note
id: generate-release-note
env:
AUTO_RELEASE_TOKEN: ${{ secrets.AUTO_RELEASE_TOKEN }}
run: |
.github/workflows/scripts/generate-release-note.sh '${{ inputs.release_name }}' '${{ steps.determine-release-version.outputs.RELEASE_VERSION }}' '${{ inputs.last_release_tag }}' '${{ steps.determine-release-version.outputs.RELEASE_VERSION }}' '${{ inputs.example_backend_version }}'
echo "RELEASE_NOTE_FILE=.changelog/release-${{ steps.determine-release-version.outputs.RELEASE_VERSION }}.md" >> "$GITHUB_OUTPUT"
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.AUTO_RELEASE_TOKEN }}
commit-message: "chore: upgrade helm chart depdenencies"
title: "[auto] feat: release candidate for ${{ inputs.release_name }} ${{ steps.determine-release-version.outputs.RELEASE_VERSION }}"
body-path: ${{ steps.generate-release-note.outputs.RELEASE_NOTE_FILE }}
branch: release/release-candidate-${{ inputs.release_name }}-${{ steps.determine-release-version.outputs.RELEASE_VERSION }}-${{ github.run_id }}
base: master
draft: true

- name: Clone oss-core-env repository
uses: actions/checkout@v4
with:
token: ${{ secrets.AUTO_RELEASE_TOKEN }}
repository: mojaloop/oss-core-env
ref: main
path: .tmp/oss-core-env

- name: Prepare deployment values file
run: |
set -a && . .tmp/oss-core-env/config/test-mojaloop-live/.env && set +a
sed -i "s/{{CI_ENV_NAME}}/$ENV_NAME/" .tmp/oss-core-env/config/test-mojaloop-live/${{ inputs.deployment_values_file }}
sed -i "s/{{CI_HELM_NAMESPACE}}/${{ inputs.deployment_namespace }}/" .tmp/oss-core-env/config/test-mojaloop-live/${{ inputs.deployment_values_file }}
sed -i "s/{{CI_ENV_VERSION}}/${{ steps.determine-release-version.outputs.RELEASE_VERSION }}/" .tmp/oss-core-env/config/test-mojaloop-live/${{ inputs.deployment_values_file }}
- name: Set KUBECONFIG
run: |
echo "${{ secrets.AUTO_RELEASE_KUBECONFIG }}" > .tmp/test.mojaloop.live.conf
chmod 600 .tmp/test.mojaloop.live.conf
- name: Cluster Info
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
run: kubectl cluster-info

- name: Delete existing deployments
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
run: helm ls -n ${{ inputs.deployment_namespace }} --short | xargs -L1 sh -c 'if [ -n "$1" ]; then helm uninstall -n ${{ inputs.deployment_namespace }} "$1"; fi' _

- name: Deploy backend
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
run: helm install backend mojaloop/example-mojaloop-backend --namespace ${{ inputs.deployment_namespace }}

- name: Build charts
run: |
./update-charts-dep.sh
- name: Deploy charts
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
run: |
# Install Mojaloop
helm install ${{ inputs.deployment_release_name }} ./mojaloop -f .tmp/oss-core-env/config/test-mojaloop-live/${{ inputs.deployment_values_file }} --namespace ${{ inputs.deployment_namespace }}
- name: Wait for deployment to be ready
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
timeout-minutes: 15
run: |
while [[ $(kubectl get pods -n ${{ inputs.deployment_namespace }} -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' | grep False) ]]; do
echo "Waiting for pods to be ready..."
sleep 10
done
echo "All pods are ready!"
continue-on-error: true

- name: Run TTK tests
env:
KUBECONFIG: .tmp/test.mojaloop.live.conf
timeout-minutes: 15
run: |
helm test ${{ inputs.deployment_release_name }} --namespace ${{ inputs.deployment_namespace }}
continue-on-error: true

- name: Clean up
run: |
rm -rf .tmp
131 changes: 131 additions & 0 deletions .github/workflows/manifests/first-pass/account-lookup-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: account-lookup-service

sources:
account-lookup-service:
kind: githubrelease
spec:
owner: mojaloop
token: '{{ requiredEnv "AUTO_RELEASE_TOKEN" }}'
repository: account-lookup-service
als-oracle-pathfinder:
kind: githubrelease
spec:
owner: mojaloop
token: '{{ requiredEnv "AUTO_RELEASE_TOKEN" }}'
repository: als-oracle-pathfinder
event-sidecar:
kind: githubrelease
spec:
owner: mojaloop
token: '{{ requiredEnv "AUTO_RELEASE_TOKEN" }}'
repository: event-sidecar
common:
kind: helmchart
spec:
url: https://mojaloop.github.io/charts/repo
name: common

conditions:
docker-account-lookup-service:
sourceid: account-lookup-service
kind: dockerimage
spec:
image: mojaloop/account-lookup-service
docker-als-oracle-pathfinder:
sourceid: als-oracle-pathfinder
kind: dockerimage
spec:
image: mojaloop/als-oracle-pathfinder
docker-event-sidecar:
sourceid: event-sidecar
kind: dockerimage
spec:
image: mojaloop/event-sidecar

targets:
appVersion-account-lookup-service:
sourceid: account-lookup-service
kind: file
spec:
file: account-lookup-service/Chart.yaml
matchpattern: '(account-lookup-service:) (v[\d\.]+)(-snapshot(\.\d+)?)?'
replacepattern: '$1 {{ source "account-lookup-service" }}'
appVersion-als-oracle-pathfinder:
sourceid: als-oracle-pathfinder
kind: file
spec:
file: account-lookup-service/Chart.yaml
matchpattern: '(als-oracle-pathfinder:) (v[\d\.]+)(-snapshot(\.\d+)?)?'
replacepattern: '$1 {{ source "als-oracle-pathfinder" }}'
account-lookup-service:
sourceid: account-lookup-service
kind: helmchart
spec:
name: account-lookup-service
file: values.yaml
key: $.account-lookup-service.image.tag
account-lookup-service-admin:
sourceid: account-lookup-service
kind: helmchart
spec:
name: account-lookup-service
file: values.yaml
key: $.account-lookup-service-admin.image.tag
als-oracle-pathfinder:
sourceid: als-oracle-pathfinder
kind: helmchart
spec:
name: account-lookup-service
file: values.yaml
key: $.als-oracle-pathfinder.image.tag
common:
sourceid: common
kind: helmchart
spec:
name: account-lookup-service
file: Chart.yaml
key: $.dependencies[3].version
chart-admin:
sourceid: account-lookup-service
kind: helmchart
spec:
name: account-lookup-service/chart-admin
file: values.yaml
key: $.image.tag
appversion: true
chart-admin--sidecar:
sourceid: event-sidecar
kind: helmchart
spec:
name: account-lookup-service/chart-admin
file: values.yaml
key: $.sidecar.image.tag
chart-admin--common:
sourceid: common
kind: helmchart
spec:
name: account-lookup-service/chart-admin
file: Chart.yaml
key: $.dependencies[0].version
chart-service:
sourceid: account-lookup-service
kind: helmchart
spec:
name: account-lookup-service/chart-service
file: values.yaml
key: $.image.tag
appversion: true
chart-service--sidecar:
sourceid: event-sidecar
kind: helmchart
spec:
name: account-lookup-service/chart-service
file: values.yaml
key: $.sidecar.image.tag
chart-service--common:
sourceid: common
kind: helmchart
spec:
name: account-lookup-service/chart-service
file: Chart.yaml
key: $.dependencies[0].version
Loading

0 comments on commit 9a6f7ed

Please sign in to comment.