Skip to content

Switch the repository to xpkg.upbound.io/crossplane-contrib to install the crossplane providers #824

Switch the repository to xpkg.upbound.io/crossplane-contrib to install the crossplane providers

Switch the repository to xpkg.upbound.io/crossplane-contrib to install the crossplane providers #824

Workflow file for this run

name: Primaza Pull Request Build
on:
pull_request:
branches: [ main ]
paths-ignore:
- 'scripts/**' # Ignores bash scripts
- '*.md' # Ignores .md files at the root of the repository
- '**/*.md' # Ignores .md files within subdirectories
jobs:
build:
strategy:
matrix:
java-version: [ 17 ]
uses: ./.github/workflows/checkout-maven-build.yml
with:
java-version: ${{ matrix.java-version }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
verify-in-kubernetes:
name: Verify in Kubernetes
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'
- name: Kubernetes KinD Cluster
uses: container-tools/kind-action@v2
with:
version: v0.11.1
registry: true
- name: Start Primaza
run: .github/install_primaza.sh ${{ github.repository }} ${{ github.event.pull_request.head.sha }}
- name: Register Kind cluster in Primaza
run: .github/register_local_kind_cluster_in_primaza.sh kube-system,sb
- name: Create Postgresql Service in Primaza
run: |
# First, we install Postgresql via Helm.
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install postgresql bitnami/postgresql --version 11.9.1 --set auth.username=superman --set auth.password=superman
## the service endpoint should be: "tcp:5432"
# Next, we register the Postgresql service in Primaza
.github/register_service_in_primaza.sh postgresql 11 tcp:5432 postgresql
- name: (Only if it failed) Log Primaza traces at failures
if: failure()
run: .github/print_primaza_logs.sh
# verify-e2e-example-in-kubernetes:
# name: Verify Super Hero workshop in Kubernetes
# runs-on: ubuntu-latest
# needs: [ build, verify-in-kubernetes ]
# steps:
# - uses: actions/checkout@v4
# - name: Set up JDK 17
# uses: actions/setup-java@v4
# with:
# distribution: 'temurin'
# java-version: 17
# cache: 'maven'
#
# - name: Kubernetes KinD Cluster
# uses: container-tools/kind-action@v2
# with:
# version: v0.11.1
# registry: true
#
# - name: Start Primaza
# run: .github/install_primaza.sh ${{ github.repository }} ${{ github.event.pull_request.head.sha }}
#
# - name: Install the Quarkus Super Hero application
# run: |
# KUBERNETES_NAMESPACE=app
# kubectl create namespace $KUBERNETES_NAMESPACE
#
# git clone https://github.com/quarkusio/quarkus-super-heroes
# cd quarkus-super-heroes/rest-heroes
#
# # install service binding extension
# ./mvnw quarkus:add-extension -Dextensions="quarkus-kubernetes-service-binding"
#
# # remove the third party installations via templates (we'll install these services using Primaza :) )
# rm -rf src/main/kubernetes
#
# # remove the default application.yml as we'll provide a different one with our Helm properties
# rm -rf src/main/resources/application.yml
#
# # copy the import.sql file from
# cp deploy/db-init/initialize-tables.sql src/main/resources/
#
# cat > src/main/resources/application.properties << "EOF"
# quarkus.application.name=rest-heroes
# quarkus.http.port=8080
# quarkus.hibernate-orm.sql-load-script=initialize-tables.sql
# quarkus.hibernate-orm.database.generation=drop-and-create
#
# quarkus.container-image.build=true
# quarkus.container-image.builder=docker
# quarkus.container-image.group=superhero
# quarkus.container-image.tag=1.0
# quarkus.kubernetes.deployment-target=kubernetes
# EOF
#
# # deploy super-heroes application in kind cluster
# ./mvnw clean package -DskipTests \
# -Dquarkus.container-image.push=true \
# -Dquarkus.container-image.registry=$KIND_REGISTRY \
# -Dquarkus.kubernetes.namespace=$KUBERNETES_NAMESPACE \
# -Dquarkus.kubernetes.deploy=true
#
# - name: Register Kind cluster in Primaza excluding technical namespaces for service and application discovery
# run: .github/register_local_kind_cluster_in_primaza.sh kube-system,sb
#
# - name: Wait until rest-heroes is discovered by Primaza
# run: |
# PRIMAZA_KUBERNETES_NAMESPACE=sb
# POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=primaza-app -n $PRIMAZA_KUBERNETES_NAMESPACE -o name)
# APPLICATION=$(kubectl exec -i $POD_NAME --container primaza-app -n $PRIMAZA_KUBERNETES_NAMESPACE -- sh -c "curl -H 'Accept: application/json' -s localhost:8080/applications/name/rest-heroes")
# if [ $(echo "$APPLICATION" | jq -r '.name') != "rest-heroes" ]
# then
# echo "Primaza didn't discovery the rest-heroes application: $APPLICATION"
# exit 1
# fi
#
# - name: Create Postgresql Service in Primaza
# run: |
# KUBERNETES_NAMESPACE=app
# USERNAME=superman
# PASSWORD=superman
# TYPE=postgresql
# DATABASE_NAME=database
# CREDENTIAL_TYPE=basic
#
# # First, we install Postgresql via Helm.
# helm repo add bitnami https://charts.bitnami.com/bitnami
# helm install postgresql bitnami/postgresql --namespace $KUBERNETES_NAMESPACE --version 11.9.1 --set auth.username=$USERNAME --set auth.password=$PASSWORD --set auth.database=$DATABASE_NAME
# ## the service endpoint should be: "tcp:5432"
#
# # Next, we register the Postgresql service in Primaza
# .github/register_service_in_primaza.sh postgresql 11 tcp:5432 $TYPE
#
# # We create the credentials for the PostgreSQL service recently registered
# .github/register_service_credential_in_primaza.sh postgresql-credentials postgresql $USERNAME $PASSWORD $DATABASE_NAME $CREDENTIAL_TYPE
#
# - name: Register claim
# run: .github/register_claim_in_primaza.sh heroClaimDb postgresql-11
#
# - name: Bind the application to the service using the claim
# run: .github/bind_application_to_claim_in_primaza.sh rest-heroes heroClaimDb
#
# - id: wait-for-super-hero
# name: rest-heroes should now be up and running
# run: |
# KUBERNETES_NAMESPACE=app
# # Ready means that the application is now binded with the service, so we're ok!
# kubectl wait --timeout=160s --for=condition=available deployment rest-heroes -n $KUBERNETES_NAMESPACE
#
# - name: (Only if it failed) Log Primaza traces at failures
# if: failure()
# run: .github/print_primaza_logs.sh
#
# - name: (Only if it failed) Log Rest Heroes traces at failures
# if: failure()
# run: |
# KUBERNETES_NAMESPACE=app
# echo "Deployment resource:"
# kubectl get deployment rest-heroes -o yaml -n $KUBERNETES_NAMESPACE
# echo "Logs of the deployment:"
# kubectl logs deploy/rest-heroes --all-containers=true -n $KUBERNETES_NAMESPACE
# echo "Print secret: "
# kubectl get secret rest-heroes-secret -o yaml -n $KUBERNETES_NAMESPACE
# POD_NAME=$(kubectl get pod -l app.kubernetes.io/name=rest-heroes -n $KUBERNETES_NAMESPACE -o name)
# echo "Describe pod:"
# kubectl describe $POD_NAME -n $KUBERNETES_NAMESPACE
# echo "Logs of running pod:"
# kubectl logs $POD_NAME -n $KUBERNETES_NAMESPACE
# echo "Logs of terminated pod:"
# kubectl logs -p $POD_NAME -n $KUBERNETES_NAMESPACE