Revert Operator CI

This commit is contained in:
Václav Muzikář 2022-04-11 11:59:33 +02:00 committed by Bruno Oliveira da Silva
parent 6e181a51d5
commit 20d037a4ad

View file

@ -17,58 +17,30 @@ concurrency:
jobs:
build:
name: Build distribution
name: Build
if: ${{ ( github.event_name != 'schedule' ) || ( github.event_name == 'schedule' && github.repository == 'keycloak/keycloak' ) }}
runs-on: ubuntu-latest
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: Cache Maven packages
id: cache
uses: actions/cache@v3
with:
path: |
~/.m2/repository
key: cache-1-${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: cache-1-${{ runner.os }}-m2
- name: Create the Keycloak distribution
run: |
mvn clean install -Pdistribution -DskipTests -DskipExamples -DskipTestsuite
- 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 }}
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'
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.4.3
with:
@ -78,121 +50,38 @@ jobs:
driver: docker
start args: '--addons=ingress'
- name: Build the Keycloak Docker image
run: |
cd quarkus
cp dist/target/keycloak-*.tar.gz container/
cd container
eval $(minikube -p minikube docker-env)
docker build --build-arg KEYCLOAK_DIST=$(ls keycloak-*.tar.gz) . -t keycloak:${GITHUB_SHA}
- name: Build a custom pre-augmented Keycloak Docker image
working-directory: operator
run: |
eval $(minikube -p minikube docker-env)
./scripts/build-testing-docker-images.sh ${GITHUB_SHA} keycloak custom-keycloak
- name: Test operator running locally
working-directory: operator
run: |
mvn clean verify \
-Dquarkus.kubernetes.deployment-target=kubernetes \
-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'
-Doperator.keycloak.image=keycloak:${GITHUB_SHA} \
-Doperator.keycloak.image-pull-policy=Never \
-Dtest.operator.kubernetes.ip=$(minikube ip) \
-Dtest.operator.custom.image=custom-keycloak:${GITHUB_SHA}
- name: Test operator running in cluster
working-directory: operator
run: |
eval $(minikube -p minikube docker-env)
mvn clean verify \
-Dquarkus.container-image.build=true \
-Dquarkus.container-image.build=true -Dquarkus.container-image.tag=test \
-Dquarkus.kubernetes.deployment-target=kubernetes \
-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 }} \
-Dquarkus.jib.jvm-arguments="-Djava.util.logging.manager=org.jboss.logmanager.LogManager","-Doperator.keycloak.image=keycloak:${GITHUB_SHA}","-Doperator.keycloak.image-pull-policy=Never" \
--no-transfer-progress -Dtest.operator.deployment=remote \
-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
-Dtest.operator.kubernetes.ip=$(minikube ip) \
-Dtest.operator.custom.image=custom-keycloak:${GITHUB_SHA}