Skip to content

Commit

Permalink
Add support for CentOS8 to linchpin
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Cole <ryan@localhost.localdomain>
  • Loading branch information
Ryan Cole authored and 14rcole committed Jan 30, 2020
1 parent e9c72e2 commit 966ee26
Show file tree
Hide file tree
Showing 26 changed files with 178 additions and 22 deletions.
40 changes: 39 additions & 1 deletion config/Dockerfiles/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env.SLAVE_TAG = env.SLAVE_TAG ?: 'stable-' + env.ghprbTargetBranch
env.FEDORA30_TAG = env.FEDORA30_TAG ?: 'stable-' + env.ghprbTargetBranch
env.FEDORA31_TAG = env.FEDORA31_TAG ?: 'stable-' + env.ghprbTargetBranch
env.CENTOS7_TAG = env.CENTOS7_TAG ?: 'stable-' + env.ghprbTargetBranch
env.CENTOS8_TAG = env.CENTOS8_TAG ?: 'stable-' + env.ghprbTargetBranch

DOCKER_REPO_URL = env.DOCKER_REPO_URL ?: '172.30.254.79:5000'
// if LINCHPIN_PROVIDERS is defined in jenkins global
Expand All @@ -36,7 +37,8 @@ OPENSHIFT_SERVICE_ACCOUNT = env.OPENSHIFT_SERVICE_ACCOUNT ?: 'jenkins'
executionID = UUID.randomUUID().toString()

// Pod name to use
c7podName = 'lp_centos7-' + executionID
c7podName = 'lp_centos8-' + executionID
c8podName = 'lp_centos8-' + executionID
f30podName = 'lp_fedora30-' + executionID
f31podName = 'lp_fedora31-' + executionID

Expand Down Expand Up @@ -83,6 +85,9 @@ properties(
string(defaultValue: 'stable-' + env.ghprbTargetBranch,
description: 'Tag for centos7 image',
name: 'CENTOS7_TAG'),
string(defaultValue: 'stable-' + env.ghprbTargetBranch,
description: 'Tag for centos8 image',
name: 'CENTOS8_TAG'),
string(description: 'Providers to be tested',
name: 'TEST_PROVIDERS')
]
Expand Down Expand Up @@ -130,6 +135,39 @@ stage('Tests') {
{
execute_test(c7podName, "centos7")
}
}, "centos8" : {
pipelineUtils.clearTemplateNames()
podTemplate(name: c7podName,
label: c7podName,
cloud: 'openshift',
serviceAccount: OPENSHIFT_SERVICE_ACCOUNT,
idleMinutes: 0,
namespace: OPENSHIFT_NAMESPACE,

containers: [
// This adds the custom slave container to the pod.
// Must be first with name 'jnlp'
containerTemplate(name: 'jnlp',
image: DOCKER_REPO_URL + '/' + OPENSHIFT_NAMESPACE + '/jenkins-continuous-infra-slave:' + SLAVE_TAG,
ttyEnabled: false,
args: '${computer.jnlpmac} ${computer.name}',
command: '',
workingDir: '/workDir'),
containerTemplate(name: 'centos8',
alwaysPullImage: true,
image: DOCKER_REPO_URL + '/' + OPENSHIFT_NAMESPACE + '/centos8:' + CENTOS8_TAG,
ttyEnabled: false,
command: '/usr/sbin/init',
privileged: true,
workingDir: '/workDir')
],
volumes: [
emptyDirVolume(memory: false, mountPath: '/sys/class/net')
]
)
{
execute_test(c8podName, "centos8")
}
}, fedora30: {
pipelineUtils.clearTemplateNames()
podTemplate(name: f30podName,
Expand Down
14 changes: 14 additions & 0 deletions config/Dockerfiles/JenkinsfileContainer
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ tagMap = [:]
tagMap['fedora30'] = STABLE_LABEL
tagMap['fedora31'] = STABLE_LABEL
tagMap['centos7'] = STABLE_LABEL
tagMap['centos8'] = STABLE_LABEL

// Provider: [ PATH/IN/REPO to match, ]
p_providers = ['__RELEASE__':
Expand Down Expand Up @@ -263,6 +264,17 @@ pipeline {
}
}
}
stage("centos8 image build") {
when {
// Only build if we have related files in changeset
changeset "config/Dockerfiles/centos8/**"
}
steps {
script {
tagMap['centos8'] = pipelineUtils.buildImage(openshiftProject, "centos8")
}
}
}
stage("Image Tag Report") {
steps {
script {
Expand Down Expand Up @@ -294,6 +306,8 @@ pipeline {
value: tagMap['fedora31']),
string(name: 'CENTOS7_TAG',
value: tagMap['centos7']),
string(name: 'CENTOS8_TAG',
value: tagMap['centos8']),
string(name: 'TEST_PROVIDERS',
value: test_providers)
],
Expand Down
47 changes: 47 additions & 0 deletions config/Dockerfiles/centos8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM centos:8
LABEL maintainer "https://github.com/CentOS-PaaS-SIG/linchpin"
LABEL description "This container will verify linchpin works under Centos8"

ENV HOME=/root
WORKDIR $HOME

RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RUN dnf -y install python3 platform-python-pip \
&& dnf -y install python3 platform-python-pip curl gcc python3-devel openssl-devel \
libvirt-daemon-driver-* libvirt-daemon libvirt-daemon-kvm \
qemu-kvm libvirt-daemon-config-network libvirt-python3 \
libvirt-devel virt-install file openssh mkisofs \
libvirt-client net-tools git make \
python3-lxml krb5-workstation \
python3-requests jq buildah git which \
&& pip3 install -U pip \
&& pip3 install -U setuptools \
&& pip3 install -U pygithub \
&& pip3 install -U openstackclient boto>=2.49.0 \
&& pip3 install ansible; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; \
do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*; \
rm -f /usr/sbin/vgs; \
rm -f /usr/sbin/lvs; \
rm -f /usr/sbin/pvs; \
systemctl enable libvirtd; \
systemctl enable virtlockd
RUN sed -i "/Service/a ExecStartPost=\/bin\/chmod 666 /dev/kvm" /usr/lib/systemd/system/libvirtd.service

#RUN curl -o /etc/yum.repos.d/beaker-client.repo \
# https://beaker-project.org/yum/beaker-client-CentOS.repo; \
# dnf -y install beaker-client \
RUN dnf clean all && rm -rf /var/cache/dnf;

RUN mkdir -p $HOME/.config

# /wordir should include the source code of linchpin
VOLUME [ "/workdir" , "/sys/fs/cgroup"]
CMD ["/usr/sbin/init"]
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/05_aws_ec2_vpc_endpoint
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the aws ec2 vpc subnet provisioning
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: aws

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/06_aws_ec2_elb_lb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the aws ec2 elb lb provisioning
# distros.exclude: fedora29 fedora30 centos7 fedora31
# distros.exclude: fedora29 fedora30 centos7 centos8 fedora31
# providers.include: aws

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/07_aws_ec2_template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the aws-ec2 provisioning with template data
# distros.exclude: fedora29 fedora30 centos7 fedora31
# distros.exclude: fedora29 fedora30 centos7 centos8 fedora31
# providers.include: aws

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/08_aws_ec2_vpc_nat_gateway
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the AWS EC2 VPC NAT gateway provisioning
# distros.exclude: fedora31 fedora30 centos7
# distros.exclude: fedora31 fedora30 centos7 centos8
# providers.include: aws

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/08_aws_vpc_internet_gateway
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the openstack router provisioning
# distros.exclude: fedora30 fedora31 centos7
# distros.exclude: fedora30 fedora31 centos7 centos8
# providers.include: aws
# providers.exclude: none

Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/beaker/03_beaker_inventory
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify distro selection in beaker
# distros.exclude: fedora29 centos7 fedora30
# distros.exclude: fedora29 centos7 centos8 fedora30
# providers.include: beaker
# providers.exclude: none

Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/combined/01_beaker_openstack
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Provision both beaker and openstack with one PinFile
# distros.exclude: fedora29 fedora30 centos7
# distros.exclude: fedora29 fedora30 centos7 centos8
# providers.include: none
# providers.exclude: none
#
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the gcloud compute router provisioning
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: gcloud

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/general/01_minimal
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: fedora30 centos7 fedora31
# distros.exclude: fedora30 centos7 centos8 fedora31
# providers.include: libvirt

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/libvirt/02_libvirt-storage
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: centos7 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora30 fedora31
# providers.include: libvirt

## NOTE: This is a temporary test to run libvirt tests until we fix
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/libvirt/03_libvirt-network
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: centos7 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora30 fedora31
# providers.include: libvirt

## NOTE: This is a temporary test to run libvirt tests until we fix
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/libvirt/05_libvirt-builtins
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning with global hooks
# distros.exclude: centos7 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora30 fedora31
# providers.include: libvirt

set -o pipefail
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: centos7 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora30 fedora31
# providers.include: libvirt

## NOTE: This is a temporary test to run libvirt tests until we fix
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/libvirt/07_libvirt-static-ip
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify basic provisioning for all supplied providers
# distros.exclude: centos7 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora30 fedora31
# providers.include: libvirt

## NOTE: This is a temporary test to run libvirt tests until we fix
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify os-server provisioning using inline template data
# distros.exclude: centos7 fedora29 fedora30
# distros.exclude: centos7 centos8 fedora29 fedora30
# providers.include: openshift

# Above makes sure that the openshift is ran only once avoiding
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/openstack/02_os-server-template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify os-server provisioning using inline template data
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: none

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/openstack/08_os_subnet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the openstack router provisioning
# distros.exclude: centos7 fedora29 fedora30
# distros.exclude: centos7 centos8 fedora29 fedora30
# providers.include: openstack
# providers.exclude: none

Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/openstack/11_os-port
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify os-port provisioning ( the test is currently disabled due to unavailable infra)
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: none

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/openstack/12_os-zone
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify os-zone provisioning ( the test is currently disabled due to unavailable infra)
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: none

DISTRO=${1}
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/openstack/13_os-recordset
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify os-zone provisioning ( the test is currently disabled due to unavailable infra)
# distros.exclude: centos7 fedora29 fedora30 fedora31
# distros.exclude: centos7 centos8 fedora29 fedora30 fedora31
# providers.include: none

DISTRO=${1}
Expand Down
1 change: 1 addition & 0 deletions config/s2i/create-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ templates="jenkins/jenkins-continuous-infra-slave-buildconfig-template.yaml \
jenkins/jenkins-persistent-buildconfig-template.yaml \
jenkins/buildah-buildconfig-template.yaml \
distros/centos7-buildconfig-template.yaml \
distros/centos8-buildconfig-template.yaml \
distros/fedora30-buildconfig-template.yaml \
distros/fedora31-buildconfig-template.yaml"

Expand Down
56 changes: 56 additions & 0 deletions config/s2i/distros/centos8-buildconfig-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: Template
labels:
template: centos8-builder
metadata:
annotations:
description: centos8 container
iconClass: centos8
tags: instant-app
name: centos8-builder
objects:
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
labels:
name: centos8
spec: {}
- apiVersion: v1
kind: BuildConfig
metadata:
name: centos8
spec:
output:
to:
kind: ImageStreamTag
name: centos8:latest
resources: {}
source:
contextDir: ${REPO_CONTEXTDIR}
git:
ref: ${REPO_REF}
uri: ${REPO_URL}
type: Git
strategy:
dockerStrategy:
dockerfilePath: centos8/Dockerfile
env:
- name: CONTAINER_NAME
value: centos8
type: Docker
triggers:
- type: ConfigChange
parameters:
- description: Git repository with Dockerfile and slave entrypoint.
displayName: Repository URL
name: REPO_URL
value: https://github.com/CentOS-PaaS-SIG/linchpin.git
- description: The sub-directory inside the repository.
displayName: Context Directory
name: REPO_CONTEXTDIR
value: config/Dockerfiles
- description: The git ref or tag to use for customization.
displayName: Git Reference
name: REPO_REF
value: develop
Loading

0 comments on commit 966ee26

Please sign in to comment.