Skip to content

cicd route220 transformer #3

cicd route220 transformer

cicd route220 transformer #3

name: CI/CD tr-emobility-echarging-route220
on:
push:
paths:
- "transformers/emobility-echarging/**"
- ".github/workflows/tr-emobility-echarging-route220.yml"
env:
PROJECT_NAME: tr-emobility-echarging-route220
WORKING_DIRECTORY: transformers/emobility-echarging
DOCKER_IMAGE: ghcr.io/noi-techpark/opendatahub-collectors/tr-emobility-echarging
DOCKER_TAG: ${{ github.sha }}
KUBERNETES_NAMESPACE: collector
JAVA_VERSION: 17
jobs:
build:
runs-on: ubuntu-22.04
concurrency: tr-emobility-echarging-build
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Build libs
uses: noi-techpark/github-actions/maven-build@v2
with:
working-directory: transformers/lib/rabbit-mongo-listener
java-version: ${{ env.JAVA_VERSION }}
build-command: 'mvn clean install'
- name: Build project
uses: noi-techpark/github-actions/maven-build@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}
java-version: ${{ env.JAVA_VERSION }}
build-command: 'mvn clean install'
- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
deploy-test:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-22.04
concurrency: tr-emobility-echarging-deploy-test
environment: test
env:
VALUES_YAML: infrastructure/helm/route220.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" |
.env.provenance_name="${{ env.PROJECT_NAME }}" |
.env.provenance_version="${{ github.sha}}"
' ${{ 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_DEV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_ACCESS_KEY_SECRET }}
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1
# deploy-route220-prod:
# if: github.ref == 'refs/heads/prod'
# needs: build
# runs-on: ubuntu-22.04
# concurrency: dc-rest-poller-route220-prod
# environment: prod
# env:
# VALUES_YAML: infrastructure/helm/echarging-route220.yaml
# K8S_NAME: dc-rest-poller-echarging-route220
# 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 }}"' ${{ env.VALUES_YAML}}
# yq -i '.image.tag="${{ env.DOCKER_TAG }}"' ${{ env.VALUES_YAML }}
# yq -i '.image.pullPolicy="IfNotPresent"' ${{ 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.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