Pipeline improvements
Some checks failed
ecodash/pipeline/head There was a failure building this commit
Some checks failed
ecodash/pipeline/head There was a failure building this commit
This commit is contained in:
parent
33f09c93bd
commit
90e83eaf62
77
Jenkinsfile
vendored
77
Jenkinsfile
vendored
|
@ -1,77 +0,0 @@
|
|||
pipeline {
|
||||
|
||||
agent any
|
||||
|
||||
environment {
|
||||
USER='placeholder'
|
||||
PASSWORD='placeholder'
|
||||
DOCKER_REGISTRY='git.massivebox.net'
|
||||
BUILDER_NAME='mbuilder'
|
||||
SERVICE='ecodash/ecodash'
|
||||
TAG='latest'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('Run linter and build') {
|
||||
agent { docker { image 'golang' } }
|
||||
steps {
|
||||
git url: 'https://git.massivebox.net/ecodash/ecodash'
|
||||
sh 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin'
|
||||
sh 'go mod tidy'
|
||||
sh 'golangci-lint run'
|
||||
sh 'env GOOS=linux GOARCH=amd64 go build -o app src/main/main.go'
|
||||
stash includes: 'app', name: 'ecodash-x86'
|
||||
sh 'env GOOS=linux GOARCH=arm go build -o app src/main/main.go'
|
||||
stash includes: 'app', name: 'ecodash-arm'
|
||||
stash includes: 'jenkins/Dockerfile', name: 'dockerfile'
|
||||
stash includes: 'templates/**', name: 'templates'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stage('Build x86 container') {
|
||||
steps {
|
||||
unstash 'dockerfile'
|
||||
unstash 'ecodash-x86'
|
||||
unstash 'templates'
|
||||
sh 'docker build -t $DOCKER_REGISTRY/$SERVICE:$TAG .'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Prepare buildx') {
|
||||
steps {
|
||||
sh """
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
|
||||
docker context create $BUILDER_NAME
|
||||
docker context use $BUILDER_NAME
|
||||
docker buildx create $BUILDER_NAME
|
||||
docker buildx use $BUILDER_NAME
|
||||
docker buildx inspect --bootstrap
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build arm container') {
|
||||
steps {
|
||||
unstash 'dockerfile'
|
||||
unstash 'ecodash-arm'
|
||||
unstash 'templates'
|
||||
sh 'docker buildx build --platform linux/arm64 -t $DOCKER_REGISTRY/$SERVICE:$TAG .'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
// cleanup
|
||||
sh """
|
||||
docker context rm -f $BUILDER_NAME
|
||||
docker buildx use default
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
# 🌿 EcoDash
|
||||
|
||||
[![status-badge](https://woodpecker.massivebox.net/api/badges/ecodash/ecodash/status.svg)](https://woodpecker.massivebox.net/ecodash/ecodash) [![Visit our website](https://cloud.massivebox.net/api/public/dl/yEzoZyW8?inline=true)](https://ecodash.xyz) [![Support the project](https://cloud.massivebox.net/api/public/dl/dthbBylL?inline=true)](https://ecodash.xyz/contribute)
|
||||
[![status-badge](https://woodpecker.massivebox.net/api/badges/ecodash/ecodash/status.svg)](https://woodpecker.massivebox.net/ecodash/ecohttpsdash) [![Visit our website](https://cloud.massivebox.net/api/public/dl/yEzoZyW8?inline=true)](https://ecodash.xyz) [![Support the project](https://cloud.massivebox.net/api/public/dl/dthbBylL?inline=true)](https://ecodash.xyz/contribute)
|
||||
|
||||
EcoDash is a simple way to show your users how much your server consumes.
|
||||
It's intended as a medium of transparency, that gives your users an idea about the consumption of your machine. It's not meant to be 100% accurate.
|
||||
|
|
32
jenkins/Jenkinsfile
vendored
32
jenkins/Jenkinsfile
vendored
|
@ -3,12 +3,9 @@ pipeline {
|
|||
agent any
|
||||
|
||||
environment {
|
||||
USER='user'
|
||||
PASSWORD='password'
|
||||
DOCKER_REGISTRY='git.massivebox.net'
|
||||
BUILDER_NAME='mbuilder'
|
||||
SERVICE='ecodash/ecodash'
|
||||
TAG='latest'
|
||||
}
|
||||
|
||||
stages {
|
||||
|
@ -16,14 +13,15 @@ pipeline {
|
|||
stage('Run linter and build') {
|
||||
agent { docker { image 'golang' } }
|
||||
steps {
|
||||
git url: 'https://git.massivebox.net/ecodash/ecodash'
|
||||
//sh 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin'
|
||||
checkout scm
|
||||
sh 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin'
|
||||
sh 'go mod tidy'
|
||||
//sh 'golangci-lint run'
|
||||
sh 'golangci-lint run'
|
||||
sh 'env GOOS=linux GOARCH=amd64 go build -o app src/main/main.go'
|
||||
stash includes: 'app', name: 'ecodash-x86'
|
||||
sh 'env GOOS=linux GOARCH=arm go build -o app src/main/main.go'
|
||||
stash includes: 'app', name: 'ecodash-arm'
|
||||
stash includes: 'jenkins/Dockerfile', name: 'dockerfile'
|
||||
stash includes: 'templates/**', name: 'templates'
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +29,10 @@ pipeline {
|
|||
|
||||
stage('Build x86 container') {
|
||||
steps {
|
||||
sh 'curl -L -o Dockerfile https://pasty.nikko.cf/UYU39i/raw'
|
||||
unstash 'dockerfile'
|
||||
unstash 'ecodash-x86'
|
||||
unstash 'templates'
|
||||
sh 'docker build -t $DOCKER_REGISTRY/$SERVICE:$TAG .'
|
||||
sh 'docker build -t ecodash .'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,10 +52,23 @@ pipeline {
|
|||
|
||||
stage('Build arm container') {
|
||||
steps {
|
||||
sh 'curl -L -o Dockerfile https://pasty.nikko.cf/UYU39i/raw'
|
||||
unstash 'dockerfile'
|
||||
unstash 'ecodash-arm'
|
||||
unstash 'templates'
|
||||
sh 'docker buildx build --platform linux/arm64 -t $DOCKER_REGISTRY/$SERVICE:$TAG .'
|
||||
sh 'docker buildx build --platform linux/arm64 -t ecodash .'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Publish container on tag latest') {
|
||||
when { branch 'master' }
|
||||
steps {
|
||||
withCredentials([usernamePassword(credentialsId: 'gitea-credentials', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
|
||||
sh 'docker login -u $USER -p $PASSWORD $DOCKER_REGISTRY'
|
||||
}
|
||||
sh """
|
||||
docker image tag ecodash $DOCKER_REGISTRY/$SERVICE:$TAG
|
||||
docker push $DOCKER_REGISTRY/$SERVICE:$TAG
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,3 +85,4 @@ pipeline {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue