Skip to content

Commit

Permalink
echarging ocpi driwe production cicd
Browse files Browse the repository at this point in the history
  • Loading branch information
clezag committed Jan 7, 2025
1 parent feae675 commit 8643ba8
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 248 deletions.
69 changes: 66 additions & 3 deletions .github/workflows/dc-echarging-ocpi-driwe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
if: github.ref == 'refs/heads/main'
needs:
- build
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
concurrency: dc-echarging-ocpi-driwe-deploy-test
environment: test
env:
Expand All @@ -56,6 +56,69 @@ jobs:
PULL_TOKEN: "${{ secrets.ECHARGING_DRIWE_OCPI_TOKEN_C }}"
EOF
# Merge yaml files https://mikefarah.gitbook.io/yq/operators/multiply-merge
yq -i '. *= load("override.yml")' ${{env.VALUES_YAML}}
cat <<EOF > override.yml
ingress:
enabled: true
annotations:
cert-manager.io/issuer: "letsencrypt-prod"
className: nginx
tls:
- hosts:
- driwe.ocpi.io.opendatahub.com
secretName: tls-ocpi-driwe
hosts:
- host: driwe.ocpi.io.opendatahub.com
paths:
- path: "/"
pathType: Prefix
EOF
# Different from above, we only do a shallow merge, so that original hosts are replaced, not appended
yq -i '. += load("override.yml")' ${{env.VALUES_YAML}}
- name: Deploy on cluster
uses: noi-techpark/github-actions/helm-deploy@v2
with:
k8s-name: ${{ env.K8S_NAME }}
k8s-namespace: collector
chart-path: helm/generic-collector
values-file: ${{ env.VALUES_YAML }}
aws-access-key-id: ${{ secrets[vars.AWS_KEY_ID] }}
aws-secret-access-key: ${{ secrets[vars.AWS_KEY_SECRET] }}
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1

deploy-prod:
if: github.ref == 'refs/heads/prod'
needs:
- build
runs-on: ubuntu-24.04
concurrency: dc-echarging-ocpi-driwe-deploy-prod
environment: prod
env:
VALUES_YAML: collectors/echarging-ocpi/infrastructure/helm/driwe.yaml
K8S_NAME: dc-echarging-ocpi-driwe
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Write environment-specific Helm values
run: |
cat <<EOF > override.yml
image:
repository: ${{ env.DOCKER_IMAGE }}
tag: ${{ env.DOCKER_TAG }}
pullPolicy: "IfNotPresent"
env:
LOG_LEVEL: "INFO"
envSecret:
OCPI_TOKENS: ${{ secrets.ECHARGING_OCPI_DRIWE_TOKENS }}
PULL_LOCATIONS_ENDPOINT: "https://ocpi.driwe.club/2.2.1/locations"
PULL_TOKEN: "${{ secrets.ECHARGING_DRIWE_OCPI_TOKEN_C }}"
EOF
# Merge yaml files https://mikefarah.gitbook.io/yq/operators/multiply-merge
yq -i '. *= load("override.yml")' ${{env.VALUES_YAML}}
Expand All @@ -67,7 +130,7 @@ jobs:
k8s-namespace: collector
chart-path: helm/generic-collector
values-file: ${{ env.VALUES_YAML }}
aws-access-key-id: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_ACCESS_KEY_SECRET }}
aws-access-key-id: ${{ secrets[vars.AWS_KEY_ID] }}
aws-secret-access-key: ${{ secrets[vars.AWS_KEY_SECRET] }}
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1
92 changes: 0 additions & 92 deletions .github/workflows/dc-rest-poller-echarging-driwe.yml

This file was deleted.

74 changes: 37 additions & 37 deletions .github/workflows/tr-echarging-ocpi-driwe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
concurrency: tr-echarging-ocpi-build
steps:
- name: Checkout source code
Expand Down Expand Up @@ -66,43 +66,43 @@ jobs:
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1

# deploy-prod:
# if: github.ref == 'refs/heads/prod'
# needs:
# - build
# runs-on: ubuntu-22.04
# concurrency: tr-echarging-ocpi-deploy-prod
# environment: prod
# env:
# VALUES_YAML: infrastructure/helm/values.yaml
# steps:
# - name: Checkout source code
# uses: actions/checkout@v4
deploy-driwe-prod:
if: github.ref == 'refs/heads/prod'
needs:
- build
runs-on: ubuntu-24.04
concurrency: tr-echarging-ocpi-deploy-driwe-prod
environment: prod
env:
PROJECT_NAME: tr-echarging-ocpi-driwe
VALUES_YAML: infrastructure/helm/driwe.yaml
steps:
- name: Checkout source code
uses: actions/checkout@v4

# - name: Customize values.yaml
# working-directory: ${{ env.WORKING_DIRECTORY }}
# run: |
# yq -i '
# .image.repository="${{ env.DOCKER_IMAGE }}" |
# .image.tag="${{ env.DOCKER_TAG }}" |
# .image.pullPolicy="IfNotPresent" |
- name: Customize values.yaml
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
yq -i '
.image.repository="${{ env.DOCKER_IMAGE }}" |
.image.tag="${{ env.DOCKER_TAG }}" |
.image.pullPolicy="IfNotPresent" |
# .env.BDP_PROVENANCE_NAME="${{ env.PROJECT_NAME }}" |
# .env.BDP_PROVENANCE_VERSION="${{ github.sha}}" |
# .env.BDP_BASE_URL="https://mobility.share.opendatahub.com"
.env.BDP_PROVENANCE_NAME="${{ env.PROJECT_NAME }}" |
.env.BDP_PROVENANCE_VERSION="${{ github.sha}}" |
# ' ${{ env.VALUES_YAML }}
.env.BDP_BASE_URL="https://mobility.share.opendatahub.com" |
.env.NINJA_URL="https://mobility.api.opendatahub.com"
' ${{ env.VALUES_YAML }}
# - name: Deploy on cluster
# uses: noi-techpark/github-actions/helm-deploy@v2
# with:
# k8s-name: ${{ env.PROJECT_NAME }}
# k8s-namespace: collector
# chart-path: helm/generic-collector
# values-file: ${{ env.WORKING_DIRECTORY }}/${{ env.VALUES_YAML }}
# aws-access-key-id: ${{ secrets.AWS_PROD_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_PROD_ACCESS_KEY_SECRET }}
# aws-eks-cluster-name: aws-main-eu-01
# aws-region: eu-west-1
#
#
- name: Deploy on cluster
uses: noi-techpark/github-actions/helm-deploy@v2
with:
k8s-name: ${{ env.PROJECT_NAME }}
k8s-namespace: collector
chart-path: helm/generic-collector
values-file: ${{ env.WORKING_DIRECTORY }}/${{ env.VALUES_YAML }}
aws-access-key-id: ${{ secrets[vars.AWS_KEY_ID] }}
aws-secret-access-key: ${{ secrets[vars.AWS_KEY_SECRET] }}
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1
115 changes: 0 additions & 115 deletions .github/workflows/tr-emobility-echarging-driwe.yml

This file was deleted.

2 changes: 1 addition & 1 deletion collectors/echarging-ocpi/infrastructure/helm/driwe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ env:
MQ_CLIENT: dc-echarging-ocpi-driwe
# postfix is added to provides depending on the data source (push path, pull etc.)
PROVIDER: echarging-ocpi/driwe
PULL_LOCATIONS_CRON: "*/10 * * * *"
PULL_LOCATIONS_CRON: "*/5 * * * *"

envSecret:
# List of valid tokens, no spaces etc.
Expand Down

0 comments on commit 8643ba8

Please sign in to comment.