mirror of
https://github.com/openshift/community.okd.git
synced 2026-05-06 21:22:36 +00:00
Add incluster Makefile target for CI (#13)
* Add incluster Makefile target for CI * Fix makefile
This commit is contained in:
committed by
GitHub
parent
2388d0336f
commit
f5cd29bdc9
5
Makefile
5
Makefile
@@ -2,7 +2,7 @@
|
||||
VERSION = 0.1.0
|
||||
|
||||
# To run sanity tests in a venv, set SANITY_TEST_ARGS to '--venv'
|
||||
SANITY_TEST_ARGS ?= '--docker --color'
|
||||
SANITY_TEST_ARGS ?= --docker --color
|
||||
|
||||
clean:
|
||||
rm -f community-okd-$(VERSION).tar.gz
|
||||
@@ -19,3 +19,6 @@ test-sanity: install
|
||||
|
||||
test-integration: install
|
||||
molecule test
|
||||
|
||||
test-integration-incluster: install
|
||||
ANSIBLE_COLLECTIONS_PATHS=$(shell pwd) ansible-playbook ci/incluster_integration.yml
|
||||
|
||||
66
ci/incluster_integration.yml
Normal file
66
ci/incluster_integration.yml
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
gather_facts: no
|
||||
|
||||
vars:
|
||||
namespace: default
|
||||
component: molecule-test-runner
|
||||
pull_policy: IfNotPresent
|
||||
# This will be in the form $registry/$org/$image:$$component, ie
|
||||
# quay.io/openshift/release:$component
|
||||
image_format: '{{ lookup("env", "IMAGE_FORMAT") }}'
|
||||
image: '{{ image_format | replace("$component", component) }}'
|
||||
|
||||
tasks:
|
||||
- name: Ensure clean environment
|
||||
community.okd.k8s:
|
||||
api_version: v1
|
||||
kind: Pod
|
||||
name: molecule-integration-test
|
||||
namespace: '{{ namespace }}'
|
||||
state: absent
|
||||
wait: yes
|
||||
|
||||
- name: Create molecule test pod
|
||||
community.okd.k8s:
|
||||
definition:
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: molecule-integration-test
|
||||
namespace: '{{ namespace }}'
|
||||
spec:
|
||||
containers:
|
||||
- name: test-runner
|
||||
image: '{{ image }}'
|
||||
imagePullPolicy: '{{ pull_policy }}'
|
||||
command:
|
||||
- make
|
||||
- test-integration
|
||||
restartPolicy: Never
|
||||
|
||||
- name: Wait for Pod to finish
|
||||
community.kubernetes.k8s_info:
|
||||
api_version: v1
|
||||
kind: Pod
|
||||
name: molecule-integration-test
|
||||
namespace: '{{ namespace }}'
|
||||
register: test_pod
|
||||
until: test_pod.resources.0.status.phase in ['Succeeded', 'Failed']
|
||||
delay: 6
|
||||
retries: 10
|
||||
|
||||
- name: Gather Pod Logs
|
||||
community.kubernetes.k8s_log:
|
||||
name: molecule-integration-test
|
||||
namespace: '{{ namespace }}'
|
||||
register: pod_log
|
||||
|
||||
- name: Exit with error on Pod failure
|
||||
fail:
|
||||
msg: |
|
||||
Molecule interation tests failed, see logs for more info
|
||||
|
||||
{{ pod_log.log }}
|
||||
when: test_pod.resources.0.status.phase == 'Failed'
|
||||
Reference in New Issue
Block a user