diff options
author | Christian Segundo | 2024-04-07 21:23:36 +0200 |
---|---|---|
committer | Christian Segundo | 2024-04-07 23:07:05 +0200 |
commit | aa7dec07b489dd532e5294e1e3fe59bd6d5bee92 (patch) | |
tree | 213caca151d1ae0fb13877ec82acc9e3c24165d5 | |
parent | 0f12e83a6ee233fa7fabcc37534f31ab35f0ed1f (diff) | |
download | nvim-aa7dec07b489dd532e5294e1e3fe59bd6d5bee92.tar.gz |
start building again
-rw-r--r-- | .scripts.d/10-check.sh | 29 | ||||
-rw-r--r-- | .scripts.d/20-publish.sh | 34 | ||||
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | Jenkinsfile | 29 |
4 files changed, 92 insertions, 3 deletions
diff --git a/.scripts.d/10-check.sh b/.scripts.d/10-check.sh new file mode 100644 index 0000000..ac82b0c --- /dev/null +++ b/.scripts.d/10-check.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# vim: ai:ts=8:sw=8:noet +set -EeufCo pipefail +export SHELLOPTS # propagate set to children by default +IFS=$'\t\n' + +# check required commands are in place +command -v shellcheck >/dev/null 2>&1 || { + echo 'please install shellcheck' + exit 1 +} +command -v hadolint >/dev/null 2>&1 || { + echo 'please install hadolint' + exit 1 +} + +# check all the Dockerfiles with hadolint +find . \ + -type f \ + -name 'Dockerfile' \ + -print0 | + xargs -0 -r hadolint + +# check all sh files with shellcheck +find . \ + -type f \ + -name '*.sh' \ + -print0 | + xargs -0 -r shellcheck diff --git a/.scripts.d/20-publish.sh b/.scripts.d/20-publish.sh new file mode 100644 index 0000000..916e833 --- /dev/null +++ b/.scripts.d/20-publish.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# vim: ai:ts=8:sw=8:noet +set -EeufCo pipefail +export SHELLOPTS # propagate set to children by default +IFS=$'\t\n' + +# check required commands are in place +command -v docker >/dev/null 2>&1 || { + echo 'please install docker-client' + exit 1 +} + +docker login --username "chn2guevara" \ + --password-stdin <<<"$DOCKERHUB_TOKEN" + +BUILDER_SUFFIX=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5 ; echo '') +docker run --privileged --rm tonistiigi/binfmt --install arm64 +docker buildx create --use --name "multi-arch-builder-${BUILDER_SUFFIX}" +trap "docker buildx rm 'multi-arch-builder-""${BUILDER_SUFFIX}""'" EXIT + +TAG_PREFIX="" +if [ "$GIT_BRANCH" != "master" ]; then + TAG_PREFIX="${GIT_BRANCH//\//-}-" +fi + +docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --builder "multi-arch-builder-${BUILDER_SUFFIX}" \ + --no-cache \ + --pull \ + --push \ + --build-arg "NEOVIM_VERSION=${1}" \ + --tag "chn2guevara/nvim:${TAG_PREFIX}${1}" \ + . @@ -17,10 +17,7 @@ RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/a gettext-tiny-dev \ git \ libtool \ - lua-language-server@testing \ - luacheck \ pkgconf \ - stylua \ unzip \ wget diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..861d020 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,29 @@ +String cronString = BRANCH_NAME == 'master' ? '@weekly' : '' + +pipeline { + agent any + triggers { cron(cronString) } + options { ansiColor('xterm') } + stages { + stage('Check') { + agent { + docker { + image 'ghcr.io/super-linter/super-linter:latest' + args '--entrypoint ""' + } + } + steps { sh 'bash .scripts.d/10-check.sh' } + } + stage('Publish') { + environment { DOCKERHUB_TOKEN = credentials('DOCKERHUB_TOKEN') } + parallel { + stage('stable') { + steps { sh 'bash .scripts.d/20-publish.sh stable' } + } + stage('nightly') { + steps { sh 'bash .scripts.d/20-publish.sh nightly' } + } + } + } + } +} |