www/Jenkinsfile

83 γραμμές
1,8 KiB
Text

2021-09-14 16:06:12 +03:00
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: jnlp
image: 'jenkins/inbound-agent'
args: ['\$(JENKINS_SECRET)', '\$(JENKINS_NAME)']
- name: hugo
2021-09-14 16:21:15 +03:00
image: klakegg/hugo:debian
2021-09-14 16:06:12 +03:00
command:
- sleep
args:
- 1d
- name: tea
2021-09-14 16:21:15 +03:00
image: 'alpine'
2021-09-14 16:06:12 +03:00
command:
- sleep
args:
- 1d
'''
defaultContainer 'hugo'
2021-09-14 17:21:33 +03:00
workspaceVolume dynamicPVC(requestsSize: "10Gi")
2021-09-14 16:06:12 +03:00
}
}
options {
skipDefaultCheckout()
}
stages {
stage('Grab Code') {
steps {
checkout scm
}
}
stage('Test Hugo syntax') {
steps {
2021-09-14 16:30:28 +03:00
container('hugo') {
sh 'hugo --quiet'
}
2021-09-14 16:06:12 +03:00
}
}
stage('Build the Site') {
steps {
2021-09-14 16:30:28 +03:00
container('hugo') {
sh 'hugo'
}
2021-09-14 16:06:12 +03:00
}
}
stage('Create Package') {
steps {
2021-09-14 16:30:28 +03:00
container('hugo') {
sh "tar zcvf site.tar.gz ./public/"
}
2021-09-14 16:06:12 +03:00
}
}
stage('Upload Release') {
environment {
GITEA_LOGIN = 'js-hellug-bot'
GITEA_SERVER_URL = 'https://dev.hellug.gr'
2021-09-14 16:56:29 +03:00
GITEA_SERVER_TOKEN = credentials('jenkins-pipeline-bot-token')
2021-09-14 16:06:12 +03:00
}
steps {
2021-09-14 16:30:28 +03:00
container('tea') {
2021-09-14 17:25:49 +03:00
sh 'ls -la && pwd && apk update && apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing tea'
2021-09-14 16:30:28 +03:00
sh "tea login add -n ${GITEA_LOGIN}"
2021-09-14 18:47:41 +03:00
sh "tea r create -t ${BUILD_TAG} --tag r${BUILD_NUMBER} -a site.tar.gz --repo hellug/www"
2021-09-14 16:30:28 +03:00
}
2021-09-14 16:06:12 +03:00
}
}
}
}