aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.buildkite/pipeline.yml7
-rw-r--r--Jenkinsfile69
-rw-r--r--Makefile47
3 files changed, 69 insertions, 54 deletions
diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
deleted file mode 100644
index 313fd75..0000000
--- a/.buildkite/pipeline.yml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-steps:
- - name: push
- branches: [master]
- command: |
- make docker-push \
- DOCKER_EXTRA_ARGS="-v ${HOME}/.docker:/root/.docker"
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..3dbb750
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,69 @@
+pipeline {
+ agent { label 'rootful' }
+ options { parallelsAlwaysFailFast() }
+ environment {
+ PROJECT = 'transmission-hacks'
+ IMAGE_NAME = "docker.io/chn2guevara/$PROJECT"
+ }
+ stages {
+ stage('Prepare') {
+ steps { sh 'apt-get update && apt-get install -y podman buildah' }
+ }
+ stage('Manifest') {
+ steps { sh "buildah manifest create $PROJECT" }
+ }
+ stage('Build') {
+ parallel {
+ stage('arm64/v8') {
+ steps {
+ sh"""
+ buildah build --arch arm64/v8 --network host \
+ --tag $IMAGE_NAME:latest --manifest $PROJECT .
+ """
+ }
+ }
+ stage('amd64') {
+ steps {
+ sh"""
+ buildah build --arch amd64 --network host \
+ --tag $IMAGE_NAME:latest --manifest $PROJECT .
+ """
+ }
+ }
+ }
+ }
+ stage('docker.io login') {
+ when { branch 'master' }
+ steps {
+ withCredentials([string(
+ credentialsId: 'dockerhub-personal',
+ variable: 'CREDENTIALS')
+ ]) {
+ sh '''#!/bin/bash
+ IFS=" " read -r username password <<<"$CREDENTIALS"
+ podman login docker.io \
+ --username "$username" \
+ --password-stdin <<< "$password"
+ '''
+ }
+ }
+ }
+ stage('Push latest') {
+ when { branch 'master' }
+ steps { sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:latest" }
+ }
+ stage('Push tag') {
+ when { branch 'master' }
+ steps {
+ script {
+ tag = sh(
+ returnStdout: true,
+ script: "git name-rev --name-only --tags HEAD"
+ ).trim()
+ if(tag == 'undefined') { return }
+ sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:$tag"
+ }
+ }
+ }
+ }
+}
diff --git a/Makefile b/Makefile
deleted file mode 100644
index b11d05e..0000000
--- a/Makefile
+++ /dev/null
@@ -1,47 +0,0 @@
-IMAGENAME := docker.io/chn2guevara/transmission-hacks
-VERSION := 3
-BUILDARG_PLATFORM := --platform linux/amd64,linux/arm64/v8
-DOCKER_EXTRA_ARGS :=
-
-ci-deps:
- apt-get -qq -y install \
- binfmt-support \
- ca-certificates \
- curl \
- git \
- gnupg \
- lsb-release \
- qemu-user-static \
- wget \
- jq
-
-ci-deps-docker:
- curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
- echo "deb [arch=$(shell dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(shell lsb_release -cs) stable" |\
- tee /etc/apt/sources.list.d/docker.list > /dev/null && \
- cat /etc/apt/sources.list.d/docker.list && \
- apt-get update && \
- apt-get -qq -y install \
- docker-ce \
- docker-ce-cli \
- containerd.io
-
-ci-setup-buildx:
- docker run --privileged --rm tonistiigi/binfmt --install all
- -docker buildx create --name mybuilder
- docker buildx use mybuilder
-
-ci-prepare: ci-deps ci-deps-docker ci-setup-buildx
-
-push: ci-prepare
- docker buildx build -t $(IMAGENAME):latest . --push
- docker buildx build -t $(IMAGENAME):$(VERSION) . --push
-
-docker-%:
- docker run \
- --rm \
- --privileged \
- -v /var/run/docker.sock:/var/run/docker.sock \
- -v $(shell pwd):/data \
- -w /data $(DOCKER_EXTRA_ARGS) \
- debian:stable sh -c "apt-get update && apt-get install make && make $*"