restrict policy enforcement to negotiation scope #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy EDC to Cluster | |
on: | |
push: | |
branches: ["develop", "main"] | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
REGISTRY_NAMESPACE: possible-x | |
K8S_NAMESPACE: ${{ github.ref == 'refs/heads/main' && 'mvd-001-demo' || 'edc-dev' }} | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
- name: Prepare required files | |
env: | |
USERNAME_GITHUB: ${{ github.actor }} | |
TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }} | |
run: sh ./gradlew clean build | |
- name: Docker "connector" meta | |
id: connector-meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector | |
tags: | | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main'}} | |
type=raw,value=latest-${{github.ref_name }},enable=${{ github.ref != 'refs/heads/main'}} | |
${{ github.sha }} | |
- name: Build and push "connector" | |
id: build_and_push_connector | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./connector | |
file: ./connector/Dockerfile | |
push: true | |
tags: ${{ steps.connector-meta.outputs.tags }} | |
labels: ${{ steps.connector-meta.outputs.labels }} | |
deploy-consumer: | |
runs-on: 'ubuntu-latest' | |
needs: build-and-push-image | |
steps: | |
- name: 'Invoke Kubectl Consumer' | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBECONFIG }} | |
with: | |
args: "set image deployment/consumer-edc-possible-x-edc -n ${{ env.K8S_NAMESPACE }} possible-x-edc=${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector:${{ github.sha }} " | |
deploy-provider: | |
runs-on: 'ubuntu-latest' | |
needs: build-and-push-image | |
steps: | |
- name: 'Invoke Kubectl Provider' | |
uses: actions-hub/kubectl@master | |
env: | |
KUBE_CONFIG: ${{ secrets.KUBECONFIG }} | |
with: | |
args: "set image deployment/provider-edc-possible-x-edc -n ${{ env.K8S_NAMESPACE }} possible-x-edc=${{ env.REGISTRY }}/${{ env.REGISTRY_NAMESPACE }}/connector:${{ github.sha }} " |