2022-01-12 08:06:10 +00:00
|
|
|
name: Keycloak Operator CI
|
|
|
|
|
2022-03-29 13:10:20 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches-ignore: [main]
|
|
|
|
pull_request:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2022-01-12 08:06:10 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
JDK_VERSION: 11
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
# Only run once for latest commit per ref and cancel other (previous) runs.
|
|
|
|
group: ci-operator-keycloak-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2022-04-08 08:22:01 +00:00
|
|
|
name: Build distribution
|
2022-03-29 13:10:20 +00:00
|
|
|
if: ${{ ( github.event_name != 'schedule' ) || ( github.event_name == 'schedule' && github.repository == 'keycloak/keycloak' ) }}
|
2022-01-12 08:06:10 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-28 15:51:51 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-04-08 08:22:01 +00:00
|
|
|
- name: Set outputs
|
|
|
|
id: vars
|
|
|
|
run: echo "::set-output name=version::0.0.1-$(git rev-parse --short HEAD)"
|
2022-01-12 08:06:10 +00:00
|
|
|
- name: Update maven settings
|
|
|
|
run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/
|
2022-03-28 15:51:51 +00:00
|
|
|
- uses: actions/setup-java@v2
|
2022-01-12 08:06:10 +00:00
|
|
|
with:
|
2022-03-30 15:45:31 +00:00
|
|
|
distribution: 'temurin'
|
2022-01-12 08:06:10 +00:00
|
|
|
java-version: ${{ env.JDK_VERSION }}
|
2022-04-08 08:22:01 +00:00
|
|
|
cache: 'maven'
|
2022-01-12 08:06:10 +00:00
|
|
|
- name: Create the Keycloak distribution
|
|
|
|
run: |
|
2022-02-11 11:55:57 +00:00
|
|
|
mvn clean install -Pdistribution -DskipTests -DskipExamples -DskipTestsuite
|
2022-04-08 08:22:01 +00:00
|
|
|
- name: Login to docker registry
|
|
|
|
uses: docker/login-action@v1.14.1
|
|
|
|
with:
|
|
|
|
registry: ${{ secrets.TEST_DOCKER_REGISTRY }}
|
|
|
|
username: ${{ secrets.TEST_DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.TEST_DOCKER_TOKEN }}
|
|
|
|
- name: Build and push the Keycloak Docker image
|
|
|
|
working-directory: quarkus/container
|
|
|
|
run: |
|
|
|
|
cp ../dist/target/keycloak-*.tar.gz ./
|
|
|
|
docker build --label "quay.expires-after=20h" --build-arg KEYCLOAK_DIST=$(ls keycloak-*.tar.gz) . -t ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak:${{ steps.vars.outputs.version }}
|
|
|
|
docker push ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak:${{ steps.vars.outputs.version }}
|
|
|
|
- name: Build and push a custom pre-augmented Keycloak Docker image
|
|
|
|
working-directory: operator
|
|
|
|
run: |
|
|
|
|
./scripts/build-testing-docker-images.sh ${{ steps.vars.outputs.version }} ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/custom-keycloak
|
|
|
|
docker push ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/custom-keycloak:${{ steps.vars.outputs.version }}
|
2022-01-12 08:06:10 +00:00
|
|
|
|
2022-04-08 08:22:01 +00:00
|
|
|
test-local:
|
|
|
|
name: Test local
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set outputs
|
|
|
|
id: vars
|
|
|
|
run: echo "::set-output name=version::0.0.1-$(git rev-parse --short HEAD)"
|
|
|
|
- name: Update maven settings
|
|
|
|
run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/
|
|
|
|
- uses: actions/setup-java@v2
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: ${{ env.JDK_VERSION }}
|
|
|
|
cache: 'maven'
|
2022-02-03 08:38:45 +00:00
|
|
|
- name: Setup Minikube-Kubernetes
|
|
|
|
uses: manusa/actions-setup-minikube@v2.4.3
|
|
|
|
with:
|
|
|
|
minikube version: v1.24.0
|
|
|
|
kubernetes version: v1.22.3
|
|
|
|
github token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
driver: docker
|
2022-03-09 13:25:18 +00:00
|
|
|
start args: '--addons=ingress'
|
2022-02-11 11:55:57 +00:00
|
|
|
|
2022-02-16 11:26:04 +00:00
|
|
|
- name: Test operator running locally
|
|
|
|
working-directory: operator
|
|
|
|
run: |
|
|
|
|
mvn clean verify \
|
|
|
|
-Dquarkus.kubernetes.deployment-target=kubernetes \
|
2022-04-08 08:22:01 +00:00
|
|
|
-Doperator.keycloak.image=${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak:${{ steps.vars.outputs.version }} \
|
|
|
|
-Dtest.operator.custom.image=${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/custom-keycloak:${{ steps.vars.outputs.version }} \
|
|
|
|
-Dtest.operator.kubernetes.ip=$(minikube ip)
|
|
|
|
|
|
|
|
test-remote:
|
|
|
|
name: Test remote
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set outputs
|
|
|
|
id: vars
|
|
|
|
run: echo "::set-output name=version::0.0.1-$(git rev-parse --short HEAD)"
|
|
|
|
- name: Update maven settings
|
|
|
|
run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/
|
|
|
|
- uses: actions/setup-java@v2
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: ${{ env.JDK_VERSION }}
|
|
|
|
cache: 'maven'
|
|
|
|
- name: Setup Minikube-Kubernetes
|
|
|
|
uses: manusa/actions-setup-minikube@v2.4.3
|
|
|
|
with:
|
|
|
|
minikube version: v1.24.0
|
|
|
|
kubernetes version: v1.22.3
|
|
|
|
github token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
driver: docker
|
|
|
|
start args: '--addons=ingress'
|
2022-02-16 11:26:04 +00:00
|
|
|
|
|
|
|
- name: Test operator running in cluster
|
|
|
|
working-directory: operator
|
2022-01-12 08:06:10 +00:00
|
|
|
run: |
|
2022-02-08 14:13:58 +00:00
|
|
|
eval $(minikube -p minikube docker-env)
|
2022-02-03 08:38:45 +00:00
|
|
|
mvn clean verify \
|
2022-04-08 08:22:01 +00:00
|
|
|
-Dquarkus.container-image.build=true \
|
2022-02-03 08:38:45 +00:00
|
|
|
-Dquarkus.kubernetes.deployment-target=kubernetes \
|
2022-04-08 08:22:01 +00:00
|
|
|
-Dquarkus.jib.jvm-arguments="-Djava.util.logging.manager=org.jboss.logmanager.LogManager","-Doperator.keycloak.image=${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak:${{ steps.vars.outputs.version }}" \
|
|
|
|
-Dtest.operator.custom.image=${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/custom-keycloak:${{ steps.vars.outputs.version }} \
|
2022-03-09 13:25:18 +00:00
|
|
|
--no-transfer-progress -Dtest.operator.deployment=remote \
|
2022-04-08 08:22:01 +00:00
|
|
|
-Dtest.operator.kubernetes.ip=$(minikube ip)
|
|
|
|
|
|
|
|
test-olm:
|
|
|
|
name: Test OLM installation
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [build]
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set outputs
|
|
|
|
id: vars
|
|
|
|
run: echo "::set-output name=version::0.0.1-$(git rev-parse --short HEAD)"
|
|
|
|
- name: Update maven settings
|
|
|
|
run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/
|
|
|
|
- uses: actions/setup-java@v2
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: ${{ env.JDK_VERSION }}
|
|
|
|
cache: 'maven'
|
|
|
|
- name: Setup Minikube-Kubernetes
|
|
|
|
uses: manusa/actions-setup-minikube@v2.4.3
|
|
|
|
with:
|
|
|
|
minikube version: v1.24.0
|
|
|
|
kubernetes version: v1.22.3
|
|
|
|
github token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
driver: docker
|
|
|
|
start args: '--addons=ingress'
|
|
|
|
- name: Login to docker registry
|
|
|
|
uses: docker/login-action@v1.14.1
|
|
|
|
with:
|
|
|
|
registry: ${{ secrets.TEST_DOCKER_REGISTRY }}
|
|
|
|
username: ${{ secrets.TEST_DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.TEST_DOCKER_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build and push the operator image
|
|
|
|
working-directory: operator
|
|
|
|
run: |
|
|
|
|
mvn clean package \
|
|
|
|
-Dquarkus.container-image.build=true \
|
|
|
|
-Dquarkus.container-image.push=true \
|
|
|
|
-Dquarkus.container-image.image="${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }}/keycloak-operator:${{ steps.vars.outputs.version }}" \
|
|
|
|
-Dquarkus.container-image.labels."\"quay.expires-after\""="20h" \
|
|
|
|
-DskipTests
|
|
|
|
|
|
|
|
- name: Install OPM
|
|
|
|
uses: redhat-actions/openshift-tools-installer@v1
|
|
|
|
with:
|
|
|
|
source: "github"
|
|
|
|
opm: "1.21.0"
|
|
|
|
|
|
|
|
- name: Install Yq
|
|
|
|
run: sudo snap install yq
|
|
|
|
|
|
|
|
- name: Install OLM
|
|
|
|
working-directory: operator
|
|
|
|
run: ./scripts/install-olm.sh
|
|
|
|
|
|
|
|
- name: Prepare resources for testing on OLM
|
|
|
|
working-directory: operator
|
|
|
|
run: |
|
|
|
|
./scripts/prepare-olm-test.sh ${{ secrets.TEST_DOCKER_REGISTRY }}/${{ secrets.TEST_DOCKER_REPOSITORY }} ${{ steps.vars.outputs.version }} NONE
|
|
|
|
|
|
|
|
- name: Install the operator with OLM
|
|
|
|
working-directory: operator
|
|
|
|
run: ./scripts/install-keycloak-operator.sh
|
|
|
|
|
|
|
|
- name: Deploy an example Keycloak and wait for it to be ready
|
|
|
|
working-directory: operator
|
|
|
|
run: |
|
|
|
|
kubectl apply -f src/main/resources/example-postgres.yaml
|
|
|
|
./scripts/check-crds-installed.sh
|
|
|
|
kubectl apply -f src/main/resources/example-keycloak.yml
|
|
|
|
kubectl apply -f src/main/resources/example-realm.yaml
|
|
|
|
# Wait for the CRs to be ready
|
|
|
|
./scripts/check-examples-installed.sh
|