-
Notifications
You must be signed in to change notification settings - Fork 33
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 #368 from rpitonak/ci-fix
[CI] Use Jenkins pipeline and ansible playbooks
- Loading branch information
Showing
9 changed files
with
200 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# https://editorconfig.org/ | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
charset = utf-8 | ||
|
||
[*.py] | ||
max_line_length = 100 | ||
|
||
[Makefile] | ||
indent_style = tab | ||
|
||
[*.{json,y{a,}ml,sh}] | ||
indent_size = 2 | ||
|
||
[Dockerfile*] | ||
indent_size = 2 |
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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
FROM registry.fedoraproject.org/fedora:29 | ||
FROM registry.fedoraproject.org/fedora:30 | ||
|
||
ENV PYTHONDONTWRITEBYTECODE=yes | ||
# ANSIBLE_STDOUT_CALLBACK - nicer output from the playbook run | ||
ENV LANG=en_US.UTF-8 \ | ||
PYTHONDONTWRITEBYTECODE=yes \ | ||
WORKDIR=/src \ | ||
ANSIBLE_STDOUT_CALLBACK=debug | ||
|
||
WORKDIR /src | ||
COPY ./requirements.sh /src/ | ||
RUN ./requirements.sh && \ | ||
dnf clean all | ||
|
||
RUN dnf install -y ansible && dnf clean all | ||
|
||
WORKDIR /src | ||
COPY . /src | ||
|
||
# install all packages | ||
RUN ansible-playbook -vv -c local -i localhost, files/install-packages.yaml \ | ||
&& dnf clean all | ||
|
||
# install conu | ||
RUN pip3 install . |
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,64 @@ | ||
def onmyduffynode(script){ | ||
ansiColor('xterm'){ | ||
timestamps{ | ||
sh 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root ${DUFFY_NODE}.ci.centos.org -t \"export REPO=${REPO}; export BRANCH=${BRANCH};\" "' + script + '"' | ||
} | ||
} | ||
} | ||
|
||
def synctoduffynode(source) | ||
{ | ||
sh 'scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r ' + source + " " + "root@" + "${DUFFY_NODE}.ci.centos.org:~/" | ||
} | ||
|
||
node('userspace-containerization'){ | ||
|
||
stage('Checkout'){ | ||
checkout scm | ||
} | ||
|
||
stage('Build'){ | ||
try{ | ||
stage ("Allocate node"){ | ||
env.CICO_API_KEY = readFile("${env.HOME}/duffy.key").trim() | ||
duffy_rtn=sh( | ||
script: "cico --debug node get --arch x86_64 -f value -c hostname -c comment", | ||
returnStdout: true | ||
).trim().tokenize(' ') | ||
env.DUFFY_NODE=duffy_rtn[0] | ||
env.DUFFY_SSID=duffy_rtn[1] | ||
} | ||
|
||
stage ("Setup"){ | ||
onmyduffynode "yum -y install epel-release docker make podman rpm-build python36-pip python36-devel" | ||
onmyduffynode "pip3 install --upgrade pip" | ||
onmyduffynode "pip3 install pre-commit" | ||
synctoduffynode "./." // copy all source files (hidden too, we need .git/) | ||
} | ||
|
||
stage ("Setup Openshift Cluster"){ | ||
make setup-oc-cluster-ci | ||
} | ||
|
||
stage ("Image build"){ | ||
onmyduffynode "make container-image" | ||
} | ||
|
||
stage ("Test image build"){ | ||
onmyduffynode "make build-test-container" | ||
} | ||
|
||
stage ("Run tests"){ | ||
onmyduffynode "make test-in-container" | ||
} | ||
|
||
} catch (e) { | ||
currentBuild.result = "FAILURE" | ||
throw e | ||
} finally { | ||
stage("Cleanup"){ | ||
sh 'cico node done ${DUFFY_SSID}' | ||
} | ||
} | ||
} | ||
} |
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,59 @@ | ||
--- | ||
- name: Inastall dependencies needed for OpenShift | ||
hosts: all | ||
tasks: | ||
- name: Install rpms. | ||
yum: | ||
name: | ||
- git | ||
- docker | ||
state: present | ||
- name: Put SELinux in permissive mode, logging actions that would be blocked. | ||
selinux: | ||
policy: targeted | ||
state: permissive | ||
- name: Stop service firewall, if running | ||
systemd: | ||
name: firewalld | ||
state: stopped # firewall on CentOS does not allow docker login into OpenShift registry | ||
- name: Make sure docker is running | ||
systemd: | ||
name: docker | ||
state: started | ||
- name: Create docker deamon config | ||
file: | ||
path: /etc/docker/daemon.json | ||
state: touch | ||
- name: Add OpenShift insecure registry into docker deamon config | ||
copy: | ||
content: | | ||
{"insecure-registries" : [ "172.30.0.0/16" ]} | ||
dest: /etc/docker/daemon.json | ||
- name: Restart docker because config has changed | ||
systemd: | ||
state: restarted | ||
daemon_reload: yes | ||
name: docker | ||
- name: Install OpenShift server | ||
yum: | ||
name: | ||
- centos-release-openshift-origin310 | ||
state: present | ||
- name: Install OpenShift client | ||
yum: | ||
name: | ||
- origin-clients | ||
state: present | ||
- name: Start Openshift cluster | ||
command: oc cluster up --base-dir=/tmp | ||
environment: | ||
PATH: "{{ ansible_env.PATH}}:/usr/local/bin" | ||
DOCKER_CONFIG: "/etc/docker/daemon.json" | ||
|
||
- name: Add permissions for developer account | ||
command: "{{ item }}" | ||
with_items: | ||
- oc login -u system:admin | ||
- oc adm policy add-cluster-role-to-user admin developer | ||
- oc adm policy add-cluster-role-to-user cluster-admin developer | ||
- oc login -u developer -p developer |
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,29 @@ | ||
--- | ||
- name: Install dependencies for conu. | ||
hosts: all | ||
tasks: | ||
- name: Install all RPM packages needed to hack on conu. | ||
dnf: | ||
name: | ||
- make | ||
- nmap-ncat | ||
- docker | ||
- libselinux-utils | ||
- source-to-image | ||
- python3-pip | ||
- python3-pyxattr | ||
- gcc | ||
- python3-devel | ||
- podman | ||
- skopeo | ||
- origin-clients | ||
state: present | ||
tags: | ||
- conu-deps | ||
|
||
- name: Install test requirements | ||
pip: | ||
executable: /usr/bin/pip3 | ||
requirements: "{{ lookup('env','PWD') }}/tests/requirements.txt" | ||
tags: | ||
- conu-test-deps |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
requests | ||
six | ||
docker | ||
kubernetes | ||
kubernetes==8.0.0 | ||
pytest |
This file was deleted.
Oops, something went wrong.