Inital Commit
This commit is contained in:
61
Other-Builds/DistroBuilder.Jenkinsfile
Normal file
61
Other-Builds/DistroBuilder.Jenkinsfile
Normal file
@@ -0,0 +1,61 @@
|
||||
String[] VariantList = ['Default', 'CustomSquashCentos', 'BrampCustom']
|
||||
pipeline {
|
||||
agent any
|
||||
options {
|
||||
skipDefaultCheckout()
|
||||
buildDiscarder(logRotator(numToKeepStr: '2', artifactNumToKeepStr: '1'))
|
||||
}
|
||||
tools {
|
||||
go 'latest'
|
||||
}
|
||||
stages {
|
||||
stage('Prepare') {
|
||||
steps {
|
||||
// Cleanup before starting
|
||||
cleanWs()
|
||||
// Checkout the repository
|
||||
git 'https://github.com/lxc/distrobuilder'
|
||||
}
|
||||
}
|
||||
stage('Image Configs'){
|
||||
steps{
|
||||
script{
|
||||
for(Variant in VariantList){
|
||||
env.Variant = Variant
|
||||
stage('Build image') {
|
||||
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
|
||||
sh '''mkdir -p "$WORKSPACE"/bin "$WORKSPACE"/build
|
||||
if [ "${Variant}" = "CustomSquashCentos" ] || [ "${Variant}" = "BrampCustom" ]
|
||||
then
|
||||
sed -i 's/shared.RunCommand("mount", "-o", "ro", filePath, isoDir)/shared.RunCommand("fuseiso", filePath, isoDir)/g' $WORKSPACE/sources/centos-http.go
|
||||
sed -i 's/shared.RunCommand("mount", "-o", "ro", imageFile, installDir)/shared.RunCommand("squashfuse", "-o", "ro", imageFile, installDir)/g' $WORKSPACE/sources/centos-http.go
|
||||
#Not Yet nedded for centos#sed -i 's/shared.RunCommand("mount", "-o", "ro", squashfsImage, squashfsDir)/shared.RunCommand("squashfuse", "-o", "ro", squashfsImage, squashfsDir)/g' $WORKSPACE/sources/centos-http.go
|
||||
sed -i 's/shared.RunCommand("mount", "-o", "ro", rootfsFile, rootfsDir)/shared.RunCommand("fuse2fs", "-o", "ro", rootfsFile, rootfsDir)/g' $WORKSPACE/sources/centos-http.go
|
||||
fi
|
||||
#Customization for BrampCustom version
|
||||
if [ "${Variant}" = "BrampCustom" ]
|
||||
then
|
||||
sed -i '/mirrorlist=/c\baseurl=http://192.168.2.83/centos/\$releasever/BaseOS/x86_64/os/' $WORKSPACE/sources/centos-http.go
|
||||
fi
|
||||
gofmt -s -w .
|
||||
go build -o build -v ./...
|
||||
go clean
|
||||
mv build/distrobuilder ./distrobuilder-"$Variant"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Finish') {
|
||||
steps {
|
||||
// Save generated files
|
||||
archiveArtifacts artifacts: 'distrobuilder-*', followSymlinks: false
|
||||
// Cleaning WorkSpace
|
||||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user