chore: add jenkins ci pipeline
arcad/edge/pipeline/head This commit looks good Details

This commit is contained in:
wpetit 2023-04-06 14:47:51 +02:00
parent dc18381dea
commit 4bc2d864ad
3 changed files with 81 additions and 2 deletions

49
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,49 @@
@Library('cadoles') _
pipeline {
agent {
dockerfile {
label 'docker'
filename 'Dockerfile'
dir 'misc/jenkins'
}
}
stages {
stage('Run unit tests') {
steps {
script {
sh 'make GOTEST_ARGS="-timeout 10m -count=1 -v" test'
}
}
}
stage('Release') {
when {
anyOf {
branch 'master'
branch 'develop'
}
}
steps {
script {
withCredentials([
usernamePassword([
credentialsId: 'forge-jenkins',
usernameVariable: 'GITEA_RELEASE_USERNAME',
passwordVariable: 'GITEA_RELEASE_PASSWORD'
])
]) {
sh 'make gitea-release'
}
}
}
}
}
post {
always {
cleanWs()
}
}
}

View File

@ -10,7 +10,7 @@ GIT_VERSION := $(shell git describe --always)
DATE_VERSION := $(shell date +%Y.%-m.%-d) DATE_VERSION := $(shell date +%Y.%-m.%-d)
FULL_VERSION := v$(DATE_VERSION)-$(GIT_VERSION)$(if $(shell git diff --stat),-dirty,) FULL_VERSION := v$(DATE_VERSION)-$(GIT_VERSION)$(if $(shell git diff --stat),-dirty,)
build: build-edge-cli build: build-edge-cli build-client-sdk-test-app
watch: watch:
go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest go run -mod=readonly github.com/cortesi/modd/cmd/modd@latest
@ -30,10 +30,12 @@ build-edge-cli: build-sdk
-o ./bin/cli \ -o ./bin/cli \
./cmd/cli ./cmd/cli
build-client-sdk-test-app:
cd misc/client-sdk-testsuite && $(MAKE) dist
install-git-hooks: install-git-hooks:
git config core.hooksPath .githooks git config core.hooksPath .githooks
tools/esbuild/bin/esbuild: tools/esbuild/bin/esbuild:
mkdir -p tools/esbuild/bin mkdir -p tools/esbuild/bin
curl -fsSL https://esbuild.github.io/dl/$(ESBUILD_VERSION) | sh curl -fsSL https://esbuild.github.io/dl/$(ESBUILD_VERSION) | sh

28
misc/jenkins/Dockerfile Normal file
View File

@ -0,0 +1,28 @@
FROM reg.cadoles.com/proxy_cache/library/ubuntu:22.04
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
ARG http_proxy=
ARG https_proxy=
ARG GO_VERSION=1.19.2
# Install dev environment dependencies
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update -y &&\
apt-get install -y --no-install-recommends curl ca-certificates build-essential wget unzip tar git jq
# Install Go
RUN mkdir -p /tmp \
&& wget -O /tmp/go${GO_VERSION}.linux-amd64.tar.gz https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz \
&& rm -rf /usr/local/go \
&& mkdir -p /usr/local \
&& tar -C /usr/local -xzf /tmp/go${GO_VERSION}.linux-amd64.tar.gz
ENV PATH="${PATH}:/usr/local/go/bin"
# Add LetsEncrypt certificates
RUN curl -k https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/common/add-letsencrypt-ca.sh | bash
# Install NodeJS
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
&& apt-get install -y nodejs