Skip to content

Commit

Permalink
Add openshift workflow yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
NiniOak committed Sep 26, 2024
1 parent 3165977 commit 1307a19
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/openshift-acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Consul acceptance tests running against OpenShift cluster
name: OpenShift Acceptance Tests

on:
push:
branches:
- 'anita/openshift_testing_ci'
# schedule:
# # Run on Monday (1),Wednesday (3),and Friday (5) at 6:00 AM UTC, 1:00 AM EST, 10:00 PM PST
# - cron: '0 6 * * 1,3,5'

jobs:
openshift:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
with:
version: 3.9.4

- name: Install Podman
run: |
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_22.04/Release.key" | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/libcontainers.gpg
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install podman
- name: Setup OpenShift Client and kubectl
run: |
curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/openshift-client-linux.tar.gz | sudo tar -xz -C /usr/local/bin
sudo chmod +x /usr/local/bin/oc /usr/local/bin/kubectl
- name: Install and Run MicroShift cluster
run: |
sudo podman run -d --name microshift \
--privileged \
-v microshift-data:/var/lib \
-p 6443:6443 \
quay.io/microshift/microshift-aio:latest
# Wait for MicroShift cluster to be ready (may need to be increased)
sleep 60
# Set up kubeconfig
mkdir -p ${HOME}/.kube
sudo podman cp \
microshift:/var/lib/microshift/resources/kubeadmin/kubeconfig \
${HOME}/.kube/config
sudo chown $(id -u):$(id -g) ${HOME}/.kube/config
chmod 600 ${HOME}/.kube/config
# Display cluster info
kubectl cluster-info
# - name: Install OVN-Kubernetes-MicroShift
# run: |
# # Clone the OVN-Kubernetes-MicroShift repository
# git clone https://github.com/openshift/ovn-kubernetes-microshift.git
# cd ovn-kubernetes-microshift

# kubectl apply -f manifests/

# # Wait for OVN-Kubernetes pods to be ready
# kubectl rollout status daemonset/ovnkube-node -n openshift-ovn-kubernetes --timeout=300s

- name: Install Consul on MicroShift
run: |
helm repo add hashicorp https://helm.releases.hashicorp.com
helm repo update
kubectl create namespace consul
helm install consul hashicorp/consul --namespace consul --set global.name=consul
kubectl rollout status statefulset/consul-server -n consul --timeout=300s
kubectl get pods -n consul
1 change: 1 addition & 0 deletions .github/workflows/reusable-conditional-skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
# for usage, options, and more details on match syntax.
files: |
.github/workflows/reusable-conditional-skip.yml
.github/workflows/openshift-acceptance.yml
LICENSE
.copywrite.hcl
.gitignore
Expand Down

0 comments on commit 1307a19

Please sign in to comment.