test & deploy: testing Jenkinsfile to determine whether agent can build
Some checks failed
/ desec-script (push) Has been cancelled
Some checks failed
/ desec-script (push) Has been cancelled
This commit is contained in:
parent
5964402f81
commit
d201596960
1 changed files with 42 additions and 6 deletions
48
Jenkinsfile
vendored
48
Jenkinsfile
vendored
|
|
@ -1,15 +1,51 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
environment {
|
||||||
|
PROJECT_OWNER = "devaine"
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage("Build") {
|
stage("Build") {
|
||||||
agent {
|
|
||||||
docker {
|
|
||||||
image "node:latest"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
sh "echo 'IT WORKS LMAO'"
|
// Reference: https://www.jenkins.io/doc/pipeline/steps/credentials-binding/
|
||||||
|
withCredentials([
|
||||||
|
string(
|
||||||
|
credentialsId: 'FORGEJO_REGISTRY'
|
||||||
|
variable: "FORGEJO_REGISTRY"
|
||||||
|
)
|
||||||
|
usernamePassword(
|
||||||
|
credentialsId: "FORGEJO_REGISTRY_LOGIN"
|
||||||
|
usernameVariable: "FORGEJO_USERNAME"
|
||||||
|
passwordVariable: "FORGEJO_PAT"
|
||||||
|
)
|
||||||
|
])
|
||||||
|
|
||||||
|
// Login to the Forgejo Registry
|
||||||
|
sh '''
|
||||||
|
printf "$FORGEJO_PAT" | docker login "$FORGEJO_REGISTRY" -u "$FOREGJO_PAT_USER" --password-stdin
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
dir('./server/desec-ip-sync/') {
|
||||||
|
sh '''
|
||||||
|
docker buildx build -t "$FOREGJO_REGISTRY"/${env.PROJECT_OWNER}/${env.JOB_NAME}
|
||||||
|
'''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean workspace after build
|
||||||
|
cleanWs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
cleanWs(
|
||||||
|
cleanWhenNotBuilt: false,
|
||||||
|
deleteDirs: true,
|
||||||
|
disableDeferredWipeout: true,
|
||||||
|
notFailBuild: true,
|
||||||
|
patterns: [[pattern: ".gitignore", type: "INCLUDE"],
|
||||||
|
[pattern: ".propsfile", type: "EXCLUDE"]]
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue