aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Segundo2023-09-16 10:44:22 +0200
committerChristian Segundo2023-09-17 04:45:46 +0200
commit02b189653a1f4a3b98fc200e2280c86aa31eda5c (patch)
tree5a5c519961af7066fec442be3d097d020e7c5bd3
parente76c12f98fbce4870422790161876163335fc809 (diff)
downloadtransmission-hacks-02b189653a1f4a3b98fc200e2280c86aa31eda5c.tar.gz
sorry
t t t t
-rw-r--r--.buildkite/pipeline.yml7
-rw-r--r--Jenkinsfile74
-rw-r--r--Makefile47
3 files changed, 74 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..564d41f
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,74 @@
+String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
+pipeline {
+ agent {
+ docker {
+ image 'quay.io/buildah/stable'
+ args '--privileged=true'
+ }
+ }
+ options { parallelsAlwaysFailFast() }
+ triggers { cron(cron_string) }
+ environment {
+ PROJECT = 'transmission-hacks'
+ IMAGE_NAME = "docker.io/chn2guevara/$PROJECT"
+ }
+ stages {
+ stage('Prepare') {
+ steps {
+ sh 'dnf install git -y'
+ script {
+ env.TAG_NAME = sh(
+ returnStdout: true,
+ script: 'git name-rev --name-only --tags HEAD | sed \'s/^undefined$//\'').trim()
+ }
+ }
+ }
+ stage('Manifest') {
+ steps { sh "buildah manifest create $PROJECT" }
+ }
+ stage('Build') {
+ parallel {
+ stage('arm64/v8') {
+ steps {
+ sh"""
+ buildah build --pull --platform linux/arm64/v8 --network host \
+ --tag $IMAGE_NAME:latest --manifest $PROJECT .
+ """
+ }
+ }
+ stage('amd64') {
+ steps {
+ sh"""
+ buildah build --pull --platform linux/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"
+ buildah login \
+ --username "$username" \
+ --password-stdin <<< "$password" docker.io
+ '''
+ }
+ }
+ }
+ stage('Push latest') {
+ when { branch 'master' }
+ steps { sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:latest" }
+ }
+ stage('Push tag') {
+ when { allOf { branch 'master'; expression { return env.TAG_NAME == '' ? false : true } } }
+ steps { sh "buildah manifest push --all $PROJECT docker://$IMAGE_NAME:$TAG_NAME" }
+ }
+ }
+}
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 $*"