Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pablo Correa
trisquel-builder
Commits
55e12848
Verified
Commit
55e12848
authored
May 23, 2021
by
Pablo Correa
Browse files
WIP: Initial Jenkinsfile configuration
parent
0214d67b
Changes
3
Hide whitespace changes
Inline
Side-by-side
ci/Jenkinsfile-gitlab
0 → 100644
View file @
55e12848
properties([
pipelineTriggers([cron(BRANCH_NAME == 'master' ? '@daily' : '')]),
buildDiscarder(logRotator(artifactDaysToKeepStr: '',
artifactNumToKeepStr: '50',
daysToKeepStr: '',
numToKeepStr: '50'))
])
node('master') {
stage('Checkout') {
// This should be a mix of the MR, Commit and Watchdog
}
}
ci/Jenkinsfile-watchdog
0 → 100644
View file @
55e12848
// Pipeline: Multibranch
properties([
pipelineTriggers([cron('H 6,12 * * *')]),
// buildDiscarder(logRotator(artifactDaysToKeepStr: '',
// artifactNumToKeepStr: '50',
// daysToKeepStr: '',
// numToKeepStr: '50'))
])
node('master') {
stage('fetch') {
// Workspace Cleanup Plugin
cleanWs(disableDeferredWipeout: false)
// Pipeline: SCM Step
def gitVars = checkout scm
}
stage('watchdog') {
// TODO: Make sure that this also prints to screen!
// Pipeline: Nodes and Processes
def packages = sh(script: 'python3 ./watchdog.py',
returnStdout: true)
print(packages)
// Operate with packages. Could possibly just reuse shell scripting
// from the current setup if that makes more sense.
String buildType = "production"
String buildDist = "etiona"
String buildBranch = "etiona"
String buildPackage = "tor"
String buildVersion = "0.4.5.8-1~bionic+1+9.0trisquel3"
// There exists multiline strings in groovy with triple quotes
// However, the don't support interpolation and look totally ugly
def String envvars = ""
envvars += "BUILD=$buildType\n"
envvars += "BUILDDIST=$buildDist\n"
envvars += "BUILDBRANCH=$buildBranch\n"
envvars += "BUILDPACKAGE=$buildPackage\n"
envvars += "BUILDVERSION=$buildVersion\n"
// Pipeline: Basic Steps
writeFile(file: "envvars.${buildPackage}.${buildDist}",
text: envvars)
// Jenkins Core
archiveArtifacts(artifacts: 'envvars.*',
allowEmptyArchive: true)
// Pipeline: Build Step
build(job: 'trisquel-build', propagate: false, wait: false, parameters: [
string(name: 'BUILDDIST', value: buildDist),
string(name: 'BUILDBRANCH', value: buildBranch),
string(name: 'BUILDPACKAGE', value: buildPackage),
])
}
}
ci/build/Jenkinsfile
0 → 100644
View file @
55e12848
// Pipeline: Multibranch
properties
([
parameters
([
string
(
name:
'BUILDDIST'
),
string
(
name:
'BUILDBRANCH'
),
string
(
name:
'BUILDPACKAGE'
)
])
])
// For this pipeline, artifacts not needed could be just stashed and unstashed
node
(
'dscbuilder'
)
{
stage
(
'dsc'
)
{
// Workspace Cleanup Plugin
cleanWs
(
disableDeferredWipeout:
false
)
// Pipeline: SCM Step
def
gitVars
=
git
(
url:
'https://gitlab.trisquel.org/trisquel/package-helpers'
,
branch:
BUILDBRANCH
,
poll:
false
)
// Here we do whatever we need to do to get the correct commit, etc.
// Pipeline: Nodes and Processes
sh
"""
#!/bin/bash
cd ./helpers
rm -rf PACKAGES
bash -e make-${BUILDPACKAGE}
"""
archiveArtifacts
(
artifacts:
"helpers/PACKAGES/${BUILDPACKAGE}/${BUILDPACKAGE}*.dsc"
,
allowEmptyArchive:
false
)
archiveArtifacts
(
artifacts:
"helpers/PACKAGES/${BUILDPACKAGE}/${BUILDPACKAGE}*.tar.gz"
,
allowEmptyArchive:
false
)
}
}
// Actually this is a multi-configuration job.
// So here we are changing a bit the behavior. This needs further testing
// and some way to avoid duplicating code
def
build_arch
(
String
architecture
)
{
// Workspace Cleanup Plugin
cleanWs
(
disableDeferredWipeout:
false
)
// Copy Artifact Plugin
copyArtifacts
(
projectName:
JOB_NAME
,
selector:
specific
(
BUILD_NUMBER
),
excludes:
'*.deb'
)
sh
(
"ls helpers/PACKAGES/${BUILDPACKAGE}"
)
sh
(
"touch ${BUILDPACKAGE}_${architecture}.deb"
)
archiveArtifacts
(
artifacts:
"*.deb"
,
allowEmptyArchive:
false
)
}
stage
(
'binary'
)
{
// Pipeline: Groovy
parallel
(
"sbuild1"
:
{
node
(
'sbuild1'
)
{
stage
(
'binary-amd64'
)
{
build_arch
(
'amd64'
)
}
stage
(
'binary-i386'
)
{
build_arch
(
'i386'
)
}
}
},
"sbuild-arm"
:
{
node
(
'sbuild-arm'
)
{
stage
(
'binary-armhf'
)
{
build_arch
(
'armhf'
)
}
}
},
failFast:
true
)
}
node
(
'archive'
)
{
stage
(
'publish'
)
{
copyArtifacts
(
projectName:
JOB_NAME
,
selector:
specific
(
BUILD_NUMBER
))
sh
(
'echo *.deb'
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment