Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Release v1.2.1 (#33)
Browse files Browse the repository at this point in the history
* First pass at adding support for ks_meta and other beaker overrides

* NoOpProvisioner support. (#24)

* First pass at adding a NoOpProvisioner

* Cleaned up linter issues with linchpin passthrough and NoOpProvisioning. Also completed initial implementation of NoOpProvisioner.

* Added basic test for NoOpProvisioning and enhanced info propagation.

* Terrible hack to create new TargetHosts

* Fixed issue with inventory file not being saved in inventoryPath var

* Tried to add explicit root user since last test failed. But manual test works

* Added cinch groups to layout file

* Updating inventory path so that Cinch group_vars are picked up

* Added tests for broken inventory paths

* Brought code coverage back to 100% and fixed a bug with constructor params not propagating for hosts

* Added pwd to lib test

* Fixed PinFile, updated hostRequires, and allowed passthrough of distro and variant (#25)

* Updated param type for hostrequires

* Adding copy over for distro and variant

* Ensuring the correct PinFile is used for provisioning

* Fixed syntax error on endifs

* Reverted provisioning conf and fixed provision test

* LinchPin passthrough arguments and SSH mode script output archiving. (#26)

* Updated param type for hostrequires

* Adding copy over for distro and variant

* Ensuring the correct PinFile is used for provisioning

* Fixed syntax error on endifs

* Reverted provisioning conf and fixed provision test

* Started adding support for output synchronization in SSH mode

* Added scriptParams object and fixed try/catch

* Trying to move playbooks into resources

* Adding the key file specification back to the playbook command

* Added missing quotes

* Writing out the file so that we can pass it as a path

* Fixed syntax error with playbooks

* Debugging failing playbooks

* Moved playbook after the extra vars spec

* Adding quotes around the invalid JSON

* Adding missing quotes x2

* Adding rsync install role to run_scripts

* Create a tmp directory to house results

* Adding the directory keyword so that it gets created

* Removing playbooks directory from paths

* Moved lookup paths to correspond with new structure

* Adding -x to ensure the script gets echo'd

* Teardown rework and SSH output synchronization (#27)

* Ensuring the correct PinFile is used for provisioning

* Reverted provisioning conf and fixed provision test

* Started adding support for output synchronization in SSH mode

* Trying to move playbooks into resources

* Adding the key file specification back to the playbook command

* Added missing quotes

* Debugging failing playbooks

* Adding quotes around the invalid JSON

* Adding missing quotes x2

* Adding rsync install role to run_scripts

* Create a tmp directory to house results

* Adding the directory keyword so that it gets created

* Removing playbooks directory from paths

* Moved lookup paths to correspond with new structure

* Adding -x to ensure the script gets echo'd

* Added logs to track error propagation

* Reworked sections to ensure errors will trigger teardown when possible

* Added support for host type override

* Altered provisioning logic to prevent double calls into linchpin provisioner

* Removed debug logs

* Cleaned up error messaging for provisioning failures

* Removed teardown log

* Upgrading release version (#28)

* Release version and linchpin distro/variant defaults fix (#29)

* Upgrading release version

* Ansible defaults choose null (a.k.a. 'None') over the default value

* Disabling codenarc in favor of having working assignments (#30)

* Added architecture to output file name to ensure parallel arch results are saved (#31)

* manual install rsync (#32)
  • Loading branch information
jaypoulz authored Nov 29, 2018
1 parent d56cbf9 commit bc2a6c7
Show file tree
Hide file tree
Showing 26 changed files with 847 additions and 166 deletions.
17 changes: 17 additions & 0 deletions resources/collect_results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: Collect Artifacts and Reports
hosts: all
gather_facts: true

vars_prompt:
- name: test_dir
prompt: "Please enter the path to your tests"

tasks:
- debug: msg="{{ test_dir }}"

- synchronize:
src: "/tmp/tests/"
dest: "{{ test_dir }}"
mode: pull
ignore_errors: true
42 changes: 42 additions & 0 deletions resources/run_scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: "Run Scripts on each Inventory Host"
hosts: all
gather_facts: true
vars_prompt:
- name: test_dir
prompt: "Please enter the path to your tests"

tasks:
- debug:
msg: "{{ test_dir }}"

- package:
name: "{{ item }}"
state: latest
with_items:
- rsync
- libselinux-python
- python2

- file:
path: "/tmp/{{ test_dir }}"
state: directory

- synchronize:
src: "{{ test_dir }}/scripts"
dest: "/tmp/{{ test_dir }}"
mode: push
ignore_errors: true

- find:
recurse: false
paths: "/tmp/{{ test_dir }}/scripts"
file_type: directory
register: scripts

- shell: "mkdir -p artifacts; bash -x test.sh {{ script_args | default('') }} &> artifacts/{{ ansible_architecture }}-output.txt"
args:
chdir: "{{ script_dir }}"
loop: "{{ scripts.files | map(attribute='path') | list }}"
loop_control:
loop_var: script_dir
6 changes: 6 additions & 0 deletions src/com/redhat/ci/Job.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class Job {
}

protected void teardown(ProvisionedHost host) {
if (!host || !host.provisioner) {
// If there isn't a host or a set provisioner, skip teardown
script.echo('Skipping teardown since host is null or host.provisioner is not set')
return
}

try {
// Ensure teardown runs before the pipeline exits
provSvc.teardown(host, config, script)
Expand Down
38 changes: 19 additions & 19 deletions src/com/redhat/ci/Utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.redhat.ci.provisioner.Mode
* Utility class to perform actions upon CI hosts.
*/
class Utils {
private static final String SUDO = 'sudo'
private static final String SUDO = 'sudo '
private static final String NO_SUDO = ''
private static final String INSTALL_FILE = 'install.sh'

Expand All @@ -22,12 +22,12 @@ class Utils {
privileged, sh ->
String sudo = privileged ? SUDO : NO_SUDO
sh("""
${sudo} yum install python-devel openssl-devel libffi-devel -y &&
${sudo} mkdir -p /home/jenkins &&
${sudo} chown --recursive \${USER}:\${USER} /home/jenkins &&
${sudo} pip install --upgrade pip &&
${sudo} pip install --upgrade setuptools &&
${sudo} pip install --upgrade ansible
${sudo}yum install python2-devel openssl-devel libffi-devel -y &&
${sudo}mkdir -p /home/jenkins &&
${sudo}chown --recursive \${USER}:\${USER} /home/jenkins &&
${sudo}pip install --upgrade pip &&
${sudo}pip install --upgrade setuptools &&
${sudo}pip install --upgrade ansible
""")
if (host == null) {
return
Expand Down Expand Up @@ -55,12 +55,12 @@ class Utils {
]) {
script.env.HOME = '/home/jenkins'
sh("""
${sudo} yum install -y krb5-workstation
${sudo} cp ${script.KRBCONF} /etc/krb5.conf
${sudo} mkdir -p /etc/beaker
${sudo} cp ${script.BKRCONF} /etc/beaker/client.conf
${sudo} chmod 644 /etc/krb5.conf
${sudo} chmod 644 /etc/beaker/client.conf
${sudo}yum install -y krb5-workstation
${sudo}cp ${script.KRBCONF} /etc/krb5.conf
${sudo}mkdir -p /etc/beaker
${sudo}cp ${script.BKRCONF} /etc/beaker/client.conf
${sudo}chmod 644 /etc/krb5.conf
${sudo}chmod 644 /etc/beaker/client.conf
kinit ${script.KRB_PRINCIPAL} -k -t ${script.KEYTAB}
mkdir -p ~/.ssh
cp ${script.SSHPRIVKEY} ~/.ssh/id_rsa
Expand All @@ -86,15 +86,15 @@ class Utils {
privileged, sh ->
String sudo = privileged ? SUDO : NO_SUDO
sh("""
echo "pkgs.devel.redhat.com,10.19.208.80 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAplqWKs26qsoaTxvWn3DFcdbiBxqRLhFngGiMYhbudnAj4li9/VwAJqLm1M6YfjOoJrj9dlmuXhNzkSzvyoQODaRgsjCG5FaRjuN8CSM/y+glgCYsWX1HFZSnAasLDuW0ifNLPR2RBkmWx61QKq+TxFDjASBbBywtupJcCsA5ktkjLILS+1eWndPJeSUJiOtzhoN8KIigkYveHSetnxauxv1abqwQTk5PmxRgRt20kZEFSRqZOJUlcl85sZYzNC/G7mneptJtHlcNrPgImuOdus5CW+7W49Z/1xqqWI/iRjwipgEMGusPMlSzdxDX4JzIx6R53pDpAwSAQVGDz4F9eQ==" | ${sudo} tee -a /etc/ssh/ssh_known_hosts
echo "pkgs.devel.redhat.com,10.19.208.80 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAplqWKs26qsoaTxvWn3DFcdbiBxqRLhFngGiMYhbudnAj4li9/VwAJqLm1M6YfjOoJrj9dlmuXhNzkSzvyoQODaRgsjCG5FaRjuN8CSM/y+glgCYsWX1HFZSnAasLDuW0ifNLPR2RBkmWx61QKq+TxFDjASBbBywtupJcCsA5ktkjLILS+1eWndPJeSUJiOtzhoN8KIigkYveHSetnxauxv1abqwQTk5PmxRgRt20kZEFSRqZOJUlcl85sZYzNC/G7mneptJtHlcNrPgImuOdus5CW+7W49Z/1xqqWI/iRjwipgEMGusPMlSzdxDX4JzIx6R53pDpAwSAQVGDz4F9eQ==" | ${sudo}tee -a /etc/ssh/ssh_known_hosts
echo "Host pkgs.devel.redhat.com" | ${sudo} tee -a /etc/ssh/ssh_config
echo "IdentityFile /home/jenkins/.ssh/id_rsa" | ${sudo} tee -a /etc/ssh/ssh_config
echo "Host pkgs.devel.redhat.com" | ${sudo}tee -a /etc/ssh/ssh_config
echo "IdentityFile /home/jenkins/.ssh/id_rsa" | ${sudo}tee -a /etc/ssh/ssh_config
${sudo} yum install -y yum-utils git
${sudo}yum install -y yum-utils git
curl -L -O http://download.devel.redhat.com/rel-eng/internal/rcm-tools-rhel-7-server.repo
${sudo} yum-config-manager --add-repo rcm-tools-rhel-7-server.repo
${sudo} yum install -y rhpkg
${sudo}yum-config-manager --add-repo rcm-tools-rhel-7-server.repo
${sudo}yum install -y rhpkg
git config --global user.name "jenkins"
""")
if (host != null) {
Expand Down
3 changes: 2 additions & 1 deletion src/com/redhat/ci/host/Type.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package com.redhat.ci.host
*/
class Type {
public static final String BAREMETAL = 'BAREMETAL'
public static final String VM = 'VM'
public static final String CONTAINER = 'CONTAINER'
public static final String UNKNOWN = 'UNKNOWN'
public static final String VM = 'VM'
}
6 changes: 6 additions & 0 deletions src/com/redhat/ci/hosts/Host.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ class Host {

// Host type specification (Baremetal, VM, container)
String type = null

// OS distro
String distro = null

// OS variant
String variant = null
}
8 changes: 8 additions & 0 deletions src/com/redhat/ci/hosts/ProvisionedHost.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,20 @@ class ProvisionedHost extends TargetHost {
super()
this.id = target.id
this.arch = target.arch
this.distro = target.distro
this.variant = target.variant
this.hostname = target.hostname
this.type = target.type
this.typePriority = target.typePriority
this.provider = target.provider
this.providerPriority = target.providerPriority
this.provisioner = target.provisioner
this.provisionerPriority = target.provisionerPriority
this.bkrHostRequires = target.bkrHostRequires
this.bkrJobGroup = target.bkrJobGroup
this.bkrKsMeta = target.bkrKsMeta
this.bkrMethod = target.bkrMethod
this.reserveDuration = target.reserveDuration
this.scriptParams = target.scriptParams
}
}
21 changes: 20 additions & 1 deletion src/com/redhat/ci/hosts/TargetHost.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package com.redhat.ci.hosts
* A target host for provisioning.
*/
class TargetHost extends Host {

// Host type priority list
List<String> typePriority = null

Expand All @@ -19,4 +18,24 @@ class TargetHost extends Host {

// Provisioner type priority list
List<String> provisionerPriority = null

// Beaker hostrequires
// Overrides ProvisioningConfig's hostrequires
List<Map> bkrHostRequires = null

// Beaker jobgroup
// Overrides ProvisioningConfig's jobgroup
String bkrJobGroup = null

// Beaker ks_meta
String bkrKsMeta = null

// Beaker installation method
String bkrMethod = null

// Reservation duration
Integer reserveDuration = null

// String of parameters to pass to script tests
String scriptParams = null
}
1 change: 1 addition & 0 deletions src/com/redhat/ci/provider/Type.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ class Type {
public static final String KUBEVIRT = 'KUBEVIRT'
public static final String OPENSHIFT = 'OPENSHIFT'
public static final String OPENSTACK = 'OPENSTACK'
public static final String UNKNOWN = 'UNKNOWN'
}
1 change: 1 addition & 0 deletions src/com/redhat/ci/provisioner/Provisioner.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ interface Provisioner {
ProvisionedHost provision(TargetHost target, ProvisioningConfig config)
void teardown(ProvisionedHost host, ProvisioningConfig config)
Boolean supportsHostType(String hostType)
List<String> filterSupportedHostTypes(List<String> hostTypes)
Boolean supportsProvider(String providerType)
}
2 changes: 1 addition & 1 deletion src/com/redhat/ci/provisioner/ProvisioningConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ProvisioningConfig {
private static final String JSWARM_EXTRA_ARGS_DEFAULT = ''

// Provisioner version
String version = 'v1.2.0'
String version = 'v1.2.1'

// Jenkins kubernetes cloud name
String cloudName = 'openshift'
Expand Down
Loading

0 comments on commit bc2a6c7

Please sign in to comment.