-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2276 from rohanKanojia/pr/github-actions-minikube
- Loading branch information
Showing
67 changed files
with
2,958 additions
and
4,626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# | ||
# Copyright (C) 2015 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
name: E2E Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
schedule: | ||
- cron: '0 1 * * *' # Everyday at 1 | ||
|
||
env: | ||
IT_REVISION: master | ||
IT_DIR: kubernetes-itests | ||
|
||
jobs: | ||
minikube: | ||
name: K8S | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
kubernetes: [v1.18.3,v1.12.0] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Minikube-Kubernetes | ||
uses: manusa/[email protected] | ||
with: | ||
minikube version: v1.9.2 | ||
kubernetes version: ${{ matrix.kubernetes }} | ||
github token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Java 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11' | ||
- name: Install Kubernetes Client | ||
run: mvn -f pom.xml -B -DskipTests clean install | ||
- name: Install and Run Integration Tests | ||
run: | | ||
cd $IT_DIR | ||
mvn test -Dtest="io.fabric8.kubernetes.**" | ||
openshift: | ||
name: OpenShift | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
openshift: [v3.11.0,v3.10.0] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup OpenShift | ||
uses: manusa/[email protected] | ||
with: | ||
oc version: ${{ matrix.openshift }} | ||
github token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Setup Java 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: '11' | ||
- name: Install Kubernetes Client | ||
run: mvn -f pom.xml -B -DskipTests clean install | ||
- name: Install and Run Integration Tests | ||
run: | | ||
cd $IT_DIR | ||
mvn test -Dtest="io.fabric8.openshift.**" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
kubernetes-itests/src/test/java/io/fabric8/commons/ClusterEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Copyright (C) 2015 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.fabric8.commons; | ||
|
||
import io.fabric8.kubernetes.api.model.DeletionPropagation; | ||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.kubernetes.api.model.Namespace; | ||
import io.fabric8.kubernetes.api.model.NamespaceList; | ||
import io.fabric8.kubernetes.client.DefaultKubernetesClient; | ||
import io.fabric8.kubernetes.client.KubernetesClient; | ||
import io.fabric8.openshift.client.DefaultOpenShiftClient; | ||
import io.fabric8.openshift.client.OpenShiftClient; | ||
|
||
import java.io.InputStream; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class ClusterEntity { | ||
|
||
public static final String FRAMEWORK = "framework"; | ||
public static final String ARQUILLIAN = "arquillian"; | ||
|
||
public static void apply(InputStream inputStream) { | ||
try (KubernetesClient client = new DefaultKubernetesClient()) { | ||
String namespace = getArquillianNamespace(); | ||
if (namespace != null) { | ||
client.load(inputStream).inNamespace(namespace).createOrReplace(); | ||
} | ||
} | ||
} | ||
|
||
public static void remove(InputStream inputStream) { | ||
try (KubernetesClient client = new DefaultKubernetesClient()) { | ||
List<HasMetadata> items = client.load(inputStream).get(); | ||
client.resourceList(items).inNamespace(getArquillianNamespace()).withPropagationPolicy(DeletionPropagation.BACKGROUND).delete(); | ||
} | ||
} | ||
|
||
public static String getArquillianNamespace() { | ||
try (KubernetesClient client = new DefaultKubernetesClient()) { | ||
NamespaceList namespaceList = client.namespaces().list(); | ||
for (Namespace namespace : namespaceList.getItems()) { | ||
|
||
// Namespace should not be in terminating state and it should have | ||
// labels. | ||
if (namespace.getMetadata().getDeletionTimestamp() == null) { | ||
if (namespace.getMetadata().getLabels() != null) { | ||
Map<String, String> labels = namespace.getMetadata().getLabels(); | ||
if (labels.containsKey(FRAMEWORK) && | ||
labels.get(FRAMEWORK).equals(ARQUILLIAN)) { | ||
return namespace.getMetadata().getName(); | ||
} | ||
} | ||
|
||
if (namespace.getMetadata().getName().startsWith("itest-")) { | ||
return namespace.getMetadata().getName(); | ||
} | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
} |
Oops, something went wrong.