Skip to content

Commit

Permalink
Merge pull request #1493 from samvarankashyap/add_fedora31_container
Browse files Browse the repository at this point in the history
Merged by Jenkins
  • Loading branch information
paas-bot authored Dec 6, 2019
2 parents cde5b8f + fab287a commit fe96fbc
Show file tree
Hide file tree
Showing 30 changed files with 229 additions and 93 deletions.
48 changes: 47 additions & 1 deletion config/Dockerfiles/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env.TARGET_BRANCH = env.ghprbTargetBranch ?: 'develop'
// Needed for podTemplate()
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

DOCKER_REPO_URL = env.DOCKER_REPO_URL ?: '172.30.254.79:5000'
Expand All @@ -37,6 +38,7 @@ executionID = UUID.randomUUID().toString()
// Pod name to use
c7podName = 'lp_centos7-' + executionID
f30podName = 'lp_fedora30-' + executionID
f31podName = 'lp_fedora31-' + executionID

def libraries = ['cico-pipeline' : ['master', 'https://github.com/CentOS/cico-pipeline-library.git'],
'ci-pipeline' : ['master', 'https://github.com/CentOS-PaaS-SIG/ci-pipeline.git']]
Expand Down Expand Up @@ -75,6 +77,9 @@ properties(
string(defaultValue: 'stable-' + env.ghprbTargetBranch,
description: 'Tag for fedora30 image',
name: 'FEDORA30_TAG'),
string(defaultValue: 'stable-' + env.ghprbTargetBranch,
description: 'Tag for fedora31 image',
name: 'FEDORA31_TAG'),
string(defaultValue: 'stable-' + env.ghprbTargetBranch,
description: 'Tag for centos7 image',
name: 'CENTOS7_TAG'),
Expand Down Expand Up @@ -158,6 +163,39 @@ stage('Tests') {
{
execute_test(f30podName, "fedora30")
}
}, fedora31: {
pipelineUtils.clearTemplateNames()
podTemplate(name: f31podName,
label: f31podName,
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: 'fedora31',
alwaysPullImage: true,
image: DOCKER_REPO_URL + '/' + OPENSHIFT_NAMESPACE + '/fedora31:' + FEDORA31_TAG,
ttyEnabled: false,
command: '/root/init_libvirt.sh',
privileged: true,
workingDir: '/workDir')
],
volumes: [
emptyDirVolume(memory: false, mountPath: '/sys/class/net')
]
)
{
execute_test(f31podName, "fedora31")
}
},
failFast: true
)
Expand Down Expand Up @@ -228,10 +266,18 @@ def execute_test(String podname, String container) {
currentStage = container + "-install"
stage(currentStage) {
dir('linchpin') {
if (container == 'centos7' || container == 'fedora30'){
pipelineUtils.executeInContainer(currentStage,
container,
"./config/Dockerfiles/linchpin-install.sh")
"./config/Dockerfiles/linchpin-install-centos7.sh")
}
else {
pipelineUtils.executeInContainer(currentStage,
container,
"./config/Dockerfiles/linchpin-install.sh")
}
}

}
currentStage = container + "-test"
stage(currentStage) {
Expand Down
14 changes: 14 additions & 0 deletions config/Dockerfiles/JenkinsfileContainer
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tagMap = [:]

// Initialize
tagMap['fedora30'] = STABLE_LABEL
tagMap['fedora31'] = STABLE_LABEL
tagMap['centos7'] = STABLE_LABEL

// Provider: [ PATH/IN/REPO to match, ]
Expand Down Expand Up @@ -240,6 +241,17 @@ pipeline {
}
}
}
stage("fedora31 image build") {
when {
// Only build if we have related files in changeset
changeset "config/Dockerfiles/fedora31/**"
}
steps {
script {
tagMap['fedora31'] = pipelineUtils.buildImage(openshiftProject, "fedora31")
}
}
}
stage("centos7 image build") {
when {
// Only build if we have related files in changeset
Expand Down Expand Up @@ -278,6 +290,8 @@ pipeline {
value: "${env.ghprbGhRepository}"),
string(name: 'FEDORA30_TAG',
value: tagMap['fedora30']),
string(name: 'FEDORA31_TAG',
value: tagMap['fedora31']),
string(name: 'CENTOS7_TAG',
value: tagMap['centos7']),
string(name: 'TEST_PROVIDERS',
Expand Down
15 changes: 0 additions & 15 deletions config/Dockerfiles/Makefile

This file was deleted.

9 changes: 4 additions & 5 deletions config/Dockerfiles/fedora30/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ LABEL description "This container will verify linchpin works under Fedora-30"
ENV HOME=/root
WORKDIR $HOME

RUN ln -s /usr/bin/python2.7 /usr/bin/python

RUN dnf -y install python-pip ansible curl gcc python-devel \
RUN dnf -y install python3-pip ansible curl gcc python3-devel \
openssl-devel libvirt-daemon-driver-* libvirt-daemon \
libvirt-daemon-kvm qemu-kvm libvirt-daemon-config-network \
libvirt-python libvirt-devel redhat-rpm-config file \
python3-libvirt libvirt-devel redhat-rpm-config file \
openssh genisoimage libvirt-client virt-install net-tools \
python-krbV make libxslt-python krb5-workstation jq buildah \
libselinux-python git \
make libxslt-python krb5-workstation jq buildah \
python3-libselinux git \
&& dnf clean all; \
(cd /lib/systemd/system/sysinit.target.wants/; for i in *; \
do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
Expand Down
49 changes: 49 additions & 0 deletions config/Dockerfiles/fedora31/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM fedora:31
LABEL maintainer "https://github.com/CentOS-PaaS-SIG/linchpin"
LABEL description "This container will verify linchpin works under Fedora-30"

ENV HOME=/root
WORKDIR $HOME


RUN dnf -y install python3-pip ansible curl gcc python3-devel \
openssl-devel libvirt-daemon-driver-* libvirt-daemon \
libvirt-daemon-kvm qemu-kvm libvirt-daemon-config-network \
python3-libvirt libvirt-devel redhat-rpm-config file \
openssh genisoimage libvirt-client virt-install net-tools \
make libxslt-python krb5-workstation jq buildah \
python3-libselinux git \
&& dnf clean all; \
(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 export GIT_PYTHON_GIT_EXECUTABLE=/usr/bin/git

RUN curl -o /etc/yum.repos.d/beaker-client.repo \
https://beaker-project.org/yum/beaker-client-Fedora.repo; \
dnf -y install beaker-client; \
dnf clean all

COPY init_libvirt.sh $HOME/

RUN pip3 install -U setuptools; \
sed -i "/Service/a ExecStartPost=\/bin\/chmod 666 /dev/kvm" \
/usr/lib/systemd/system/libvirtd.service

RUN echo "namespaces = []" >> /etc/libvirt/qemu.conf

# /workdir should include the source code of linchpin
VOLUME [ "/workdir" ]
CMD ["/usr/sbin/init"]
27 changes: 27 additions & 0 deletions config/Dockerfiles/linchpin-install-centos7.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash -x

WORKDIR=$(pwd)

pip install . --ignore-installed
pip install .[tests]
pip install .[libvirt]
pip install .[beaker]
pip install .[docker]
pip install .[azure]
pip install .[openshift]

# If duffy.key is available then install duffy ansible module.
if [ -e "keys/duffy.key" ]; then
# duffy key needs to be in home dir by default
#cp duffy ~/duffy,key

# Link duffy module linchpin library
pushd ~
linchpin_path=$(python -c 'import os, linchpin; print(os.path.dirname(linchpin.__file__))')
popd
if [ -n "$linchpin_path" ]; then
pushd $linchpin_path/provision/library
ln -s $WORKDIR/duffy-ansible-module/library/duffy.py .
popd
fi
fi
21 changes: 8 additions & 13 deletions config/Dockerfiles/linchpin-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@

WORKDIR=$(pwd)

pushd config/Dockerfiles
make pip_install.sh
./pip_install.sh
popd

pip install . --ignore-installed
pip install .[tests]
pip install .[libvirt]
pip install .[beaker]
pip install .[docker]
pip install .[azure]
pip install .[openshift]
pip3 install . --ignore-installed
pip3 install .[tests]
pip3 install .[libvirt]
#pip3 install .[beaker]
#pip3 install .[docker]
pip3 install .[azure]
pip3 install .[openshift]

# If duffy.key is available then install duffy ansible module.
if [ -e "keys/duffy.key" ]; then
Expand All @@ -22,7 +17,7 @@ if [ -e "keys/duffy.key" ]; then

# Link duffy module linchpin library
pushd ~
linchpin_path=$(python -c 'import os, linchpin; print os.path.dirname(linchpin.__file__)')
linchpin_path=$(python3 -c 'import os, linchpin; print(os.path.dirname(linchpin.__file__))')
popd
if [ -n "$linchpin_path" ]; then
pushd $linchpin_path/provision/library
Expand Down
2 changes: 1 addition & 1 deletion config/Dockerfiles/tests.d/aws/04_aws_ec2_vpc_routetable
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -xe

# Verify the aws ec2 vpc route table provisioning
# distros.exclude: fedora29 fedora30
# distros.exclude: fedora29 fedora30 fedora31
# providers.include: aws

DISTRO=${1}
Expand Down
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
# distros.exclude: centos7 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
# distros.exclude: fedora29 fedora30 centos7 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
# distros.exclude: fedora29 fedora30 centos7 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: fedora28 fedora29 fedora30 centos7
# distros.exclude: fedora31 fedora30 centos7
# 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: none
# distros.exclude: fedora30 fedora31 centos7
# providers.include: aws
# providers.exclude: none

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

# Verify the azure vm provisioning
# distros.exclude: none
# distros.exclude: fedora30 centos7 fedora31
# providers.include: azure
# providers.exclude: none

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: fedora29 fedora30 centos7
# distros.exclude: fedora30 centos7 fedora31
# providers.include: libvirt

DISTRO=${1}
Expand Down
5 changes: 2 additions & 3 deletions config/Dockerfiles/tests.d/inventory/01_template_inventory
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#!/bin/bash -xe

# Verify template-based provisioning using complex template data file
# distros.exclude: centos7 fedora30 fedora29
# providers.include: libvirt
# providers.exclude: dummy openstack beaker duffy openshift gcloud aws docker azure
# distros.exclude: centos7 fedora30 fedora31
# providers.exclude: dummy openstack beaker duffy openshift gcloud aws docker azure libvirt


DISTRO=${1}
Expand Down
4 changes: 2 additions & 2 deletions config/Dockerfiles/tests.d/inventory/02_json_inventory
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ linchpin -w . -p "${PINFILE}" -v up --if json "${TARGET}" 2>&1 | tee -a ${TMP_FI
INVENTORY_FOLDER="./inventories/"
INVENTORY_FILE=`ls -t1 $INVENTORY_FOLDER | head -n 1`
echo $INVENTORY_FILE
grep "\{\"test" $INVENTORY_FOLDER/$INVENTORY_FILE

grep "test" $INVENTORY_FOLDER/$INVENTORY_FILE
cat $INVENTORY_FOLDER/$INVENTORY_FILE
RC0=${?}

if [ ${RC0} -eq 0 ] ; then
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 fedora29
# distros.exclude: centos7 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 fedora29
# distros.exclude: centos7 fedora30 fedora31
# providers.include: libvirt

## NOTE: This is a temporary test to run libvirt tests until we fix
Expand Down
Loading

0 comments on commit fe96fbc

Please sign in to comment.