78 lines
2.7 KiB
YAML
78 lines
2.7 KiB
YAML
name: Keycloak Operator CI
|
|
|
|
on:
|
|
push:
|
|
branches-ignore: [main]
|
|
pull_request:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
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:
|
|
name: Build
|
|
if: ${{ ( github.event_name != 'schedule' ) || ( github.event_name == 'schedule' && github.repository == 'keycloak/keycloak' ) }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Update maven settings
|
|
run: mkdir -p ~/.m2 ; cp .github/settings.xml ~/.m2/
|
|
- uses: actions/setup-java@v1
|
|
with:
|
|
java-version: ${{ env.JDK_VERSION }}
|
|
- name: Cache Maven packages
|
|
id: cache
|
|
uses: actions/cache@v2
|
|
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: 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: 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: Test operator running locally
|
|
working-directory: operator
|
|
run: |
|
|
mvn clean verify \
|
|
-Dquarkus.kubernetes.deployment-target=kubernetes \
|
|
-Doperator.keycloak.image=keycloak:${GITHUB_SHA} \
|
|
-Doperator.keycloak.image-pull-policy=Never \
|
|
-Dtest.operator.kubernetes.ip=$(minikube ip)
|
|
|
|
- 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.tag=test \
|
|
-Dquarkus.kubernetes.deployment-target=kubernetes \
|
|
-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)
|