Run the operator tests using a fresh build of Keycloak

This commit is contained in:
andreaTP 2022-02-11 11:55:57 +00:00 committed by Pedro Igor
parent f3c3bb5001
commit 541043c862
5 changed files with 31 additions and 3 deletions

View file

@ -32,7 +32,7 @@ jobs:
- name: Create the Keycloak distribution
run: |
mvn clean install -DskipTests -DskipExamples -DskipTestsuite
mvn clean install -Pdistribution -DskipTests -DskipExamples -DskipTestsuite
- name: Setup Minikube-Kubernetes
uses: manusa/actions-setup-minikube@v2.4.3
@ -41,6 +41,15 @@ jobs:
kubernetes version: v1.22.3
github token: ${{ secrets.GITHUB_TOKEN }}
driver: docker
- 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 , deploy and test operator in minikube
run: |
cd operator
@ -48,4 +57,5 @@ jobs:
mvn clean verify \
-Dquarkus.container-image.build=true -Dquarkus.container-image.tag=test \
-Dquarkus.kubernetes.deployment-target=kubernetes \
--no-transfer-progress -Dtest.operator.deployment=remote
-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

View file

@ -17,6 +17,20 @@ Build the Docker image with:
mvn clean package -Doperator -Dquarkus.container-image.build=true
```
## Configuration
The Keycloak image can be configured, when starting the operator, using the Java property:
```
operator.keycloak.image
```
And the imagePullPolicy with:
```
operator.keycloak.image-pull-policy
```
## Contributing
### Quick start on Minikube

View file

@ -28,5 +28,6 @@ public interface Config {
interface Keycloak {
String image();
String imagePullPolicy();
}
}

View file

@ -105,6 +105,8 @@ public class KeycloakDeployment extends OperatorManagedResource {
serverConfig.putAll(keycloakCR.getSpec().getServerConfiguration());
}
container.setImagePullPolicy(config.keycloak().imagePullPolicy());
container.setEnv(serverConfig.entrySet().stream()
.map(e -> new EnvVarBuilder().withName(e.getKey()).withValue(e.getValue()).build())
.collect(Collectors.toList()));

View file

@ -5,4 +5,5 @@ quarkus.container-image.builder=jib
quarkus.operator-sdk.crd.validate=false
# Operator config
operator.keycloak.image=quay.io/keycloak/keycloak-x:latest
operator.keycloak.image=quay.io/keycloak/keycloak-x:latest
operator.keycloak.image-pull-policy=Always