Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Foreman's stable job testing to a pipeline #525

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions branch-foreman
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,3 @@ echo "- '${FOREMAN_VERSION}'" >> theforeman.org/yaml/includes/foreman_versions.y
echo "- '${FOREMAN_VERSION}'" >> theforeman.org/yaml/includes/foreman_versions_copr.yaml.inc

echo " - '${KATELLO_VERSION}'" >> theforeman.org/yaml/jobs/pipeline/katello-rpm-pipeline.yaml

# TODO This should be a templated pipeline
echo "Create theforeman.org/yaml/jobs/test_${FOREMAN_VERSION/./_}_stable.yaml"

# TODO This is a non-trivial addition to script
echo "Add ${FOREMAN_VERSION%*.} as a minor to theforeman.org/yaml/views/release.yml"
64 changes: 64 additions & 0 deletions theforeman.org/pipelines/test/foreman.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
pipeline {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tihs top level pipeline needs an agent declaration:

pipeline {
  agent none

options {
timestamps()
timeout(time: 2, unit: 'HOURS')
ansiColor('xterm')
}

environment {
RUBY_VERSION = ruby_version
BUNDLE_WITHOUT = 'development'
RAILS_ENV = railsEnvForTask(RAKE_TASK)
DATABASE_URL = databaseUrlForTask(RAKE_TASK)
TESTOPTS = '-v'
}

matrix {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this has to be a child of at least a stages-stage declaration:

 stages {
     stage('') {
       matrix { 

agent { label 'fast' }
axes {
axis {
name 'RAKE_TASK'
values 'jenkins:unit', 'jenkins:integration', 'assets:precompile'
}
}
stages {
stage('setup') {
steps {
git branch: git_branch, url: 'https://github.com/theforeman/foreman'
bundleInstall(RUBY_VERSION)
archiveArtifacts(artifacts: 'Gemfile.lock')
script {
if (RAKE_TASK == 'assets:precompile') {
sh "cp db/schema.rb.nulldb db/schema.rb"
filter_package_json(RUBY_VERSION)
}
if (RAKE_TASK == 'jenkins:integration' || RAKE_TASK == 'assets:precompile' ){
withRuby(RUBY_VERSION, 'npm install --no-audit --legacy-peer-deps')
archiveArtifacts(artifacts: 'package-lock.json')
}
}
}
}
stage('database') {
steps {
bundleExec(RUBY_VERSION, "rake db:create --trace")
bundleExec(RUBY_VERSION, "rake db:migrate --trace")
}
}
stage('rake task') {
steps {
bundleExec(RUBY_VERSION, "rake ${RAKE_TASK} --trace")
}
}
}
post {
always {
junit(testResults: 'jenkins/reports/*/*.xml', allowEmptyResults: RAKE_TASK == 'assets:precompile')
}
cleanup {
bundleExec(RUBY_VERSION, 'rake db:drop DISABLE_DATABASE_ENVIRONMENT_CHECK=true')
deleteDir()
}
}
}
}
1 change: 1 addition & 0 deletions theforeman.org/pipelines/vars/foreman/3.11.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def foreman_version = '3.11'
def git_branch = "${foreman_version}-stable"
def ruby_version = '2.7.6'

def foreman_client_distros = [
'el9',
Expand Down
1 change: 1 addition & 0 deletions theforeman.org/pipelines/vars/foreman/3.12.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def foreman_version = '3.12'
def git_branch = "${foreman_version}-stable"
def ruby_version = '2.7.6'

def foreman_client_distros = [
'el9',
Expand Down
1 change: 1 addition & 0 deletions theforeman.org/pipelines/vars/foreman/3.13.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def foreman_version = '3.13'
def git_branch = "${foreman_version}-stable"
def ruby_version = '2.7.6'

def foreman_client_distros = [
'el9',
Expand Down
1 change: 1 addition & 0 deletions theforeman.org/pipelines/vars/foreman/nightly.groovy
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def foreman_version = 'nightly'
def git_branch = "develop"
def ruby_version = '2.7.6'

def foreman_client_distros = [
'el10',
Expand Down
4 changes: 0 additions & 4 deletions theforeman.org/yaml/builders/test_develop.yaml

This file was deleted.

16 changes: 16 additions & 0 deletions theforeman.org/yaml/jobs/pipeline/foreman-stable-pipelines.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
- job-template:
name: 'foreman-{version}-stable-test'
project-type: pipeline
sandbox: true
properties:
- github:
url: https://github.com/theforeman/foreman
dsl:
!include-raw-verbatim:
- 'pipelines/vars/foreman/{version}.groovy'
- 'pipelines/test/foreman.groovy{empty}'
- 'pipelines/lib/rbenv.groovy{empty}'

- job-template:
name: 'smart-proxy-{version}-stable-test'
project-type: pipeline
Expand All @@ -15,7 +28,10 @@
- project:
name: foreman-stable
jobs:
- 'foreman-{version}-stable-test'
- 'smart-proxy-{version}-stable-test'
views:
- 'Foreman {version}'
empty: ''
version:
!include: ../../includes/foreman_versions.yaml.inc
31 changes: 0 additions & 31 deletions theforeman.org/yaml/jobs/test_3_11_stable.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions theforeman.org/yaml/jobs/test_3_12_stable.yaml

This file was deleted.

31 changes: 0 additions & 31 deletions theforeman.org/yaml/jobs/test_3_13_stable.yaml

This file was deleted.

17 changes: 3 additions & 14 deletions theforeman.org/yaml/views/release.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
- view-template:
name: 'Foreman {major}.{minor}'
description: 'Foreman {major}.{minor} jobs'
name: 'Foreman {version}'
description: 'Foreman {version} jobs'
view-type: list
regex: '.*{major}[_\.]{minor}.*'

- project:
name: 'foreman-releases'
views:
- 'Foreman {major}.{minor}'
major:
- '3'
minor:
- '11'
- '12'
- '13'
regex: '.*-{version}-.*'

- view:
name: 'Foreman Nightly'
Expand Down
Loading