diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile new file mode 100644 index 0000000..fd20e96 --- /dev/null +++ b/.ci/Jenkinsfile @@ -0,0 +1,43 @@ +properties( + [ + disableConcurrentBuilds() + ] +) + +node('linux && docker') { + try { + stage('Checkout') { + //branch name from Jenkins environment variables + echo "My branch is: ${env.BRANCH_NAME}" + + // this doesn't grab tags pointing to this branch + //checkout scm + // this hack does... https://issues.jenkins.io/browse/JENKINS-45164 + checkout([ + $class: 'GitSCM', + branches: [[name: 'refs/heads/'+env.BRANCH_NAME]], + extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']], + userRemoteConfigs: scm.userRemoteConfigs, + ]) + sh ''' + set -euxo pipefail + git checkout "$BRANCH_NAME" -- + git reset --hard "origin/$BRANCH_NAME" + ''' + } + + stage('Build + Deploy') { + sh 'curl --compressed -sL https://code.moparisthebest.com/moparisthebest/self-ci/raw/branch/master/build-ci.sh | bash -s -- -l c -b ./build.sh' + } + + currentBuild.result = 'SUCCESS' + } catch (Exception err) { + currentBuild.result = 'FAILURE' + } finally { + stage('Email') { + step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'admin.jenkins@moparisthebest.com', sendToIndividuals: true]) + } + sh './bin/build.sh docker-chown' + deleteDir() + } +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e3574f9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: minimal -services: docker - -matrix: - include: - - env: ARCH='amd64' DOCKER_IMAGE='alpine' - - env: ARCH='aarch64' DOCKER_IMAGE='alpine' - arch: arm64 - - env: ARCH='i386' DOCKER_IMAGE='multiarch/alpine:i386-latest-stable' -# - env: ARCH='x86' DOCKER_IMAGE='multiarch/alpine:x86-latest-stable' - - env: ARCH='ppc64le' DOCKER_IMAGE='multiarch/alpine:ppc64le-latest-stable' -# - env: ARCH='armhf' DOCKER_IMAGE='multiarch/alpine:armhf-latest-stable' - - env: ARCH='armv7' DOCKER_IMAGE='multiarch/alpine:armv7-latest-stable' - arch: arm64 - -script: - - ./docker_build.sh "$DOCKER_IMAGE" "$ARCH" - -deploy: - api_key: $GITHUB_OAUTH - file_glob: true - file: curl* - on: - tags: true - provider: releases - skip_cleanup: true diff --git a/README.md b/README.md index c5f235f..8b1ee44 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ :mechanical_arm: Static curl :mechanical_arm: ----------- -[![Travis-CI Build Status](https://api.travis-ci.org/moparisthebest/static-curl.svg?branch=master)](https://travis-ci.org/moparisthebest/static-curl) +[![Build Status](https://ci.moparisthe.best/job/moparisthebest/job/static-curl/job/master/badge/icon%3Fstyle=plastic)](https://ci.moparisthe.best/job/moparisthebest/job/static-curl/job/master/) These are a couple simple scripts to build a fully static curl binary using alpine linux docker containers. Currently it is a featureful build with OpenSSL, libssh2, nghttp2, and zlib, supporting most protocols. Tweak configure options in [build.sh](build.sh#L50) if you need something else (and/or suggest or PR). @@ -18,5 +18,4 @@ Development File explanation: - [build.sh](build.sh) - runs inside an alpine docker container, downloads curl, verifies it with gpg, and builds it - - [docker_build.sh](docker_build.sh) - runs build.sh inside docker - [mykey.asc](mykey.asc) - Daniel Stenberg's [GPG key](https://daniel.haxx.se/address.html) used for signing/verifying curl releases diff --git a/build.sh b/build.sh index ed6ea97..9e2fa2f 100755 --- a/build.sh +++ b/build.sh @@ -1,20 +1,16 @@ #!/bin/sh # to test locally, run one of: -# docker run --rm -v $(pwd):/tmp alpine /tmp/build.sh -# docker run --rm -v $(pwd):/tmp multiarch/alpine:armhf-latest-stable /tmp/build.sh -# docker run --rm -v $(pwd):/tmp i386/alpine /tmp/build.sh -# docker run --rm -v $(pwd):/tmp ALPINE_IMAGE_HERE /tmp/build.sh +# docker run --rm -v $(pwd):/tmp -w /tmp -e ARCH=amd64 alpine /tmp/build.sh +# docker run --rm -v $(pwd):/tmp -w /tmp -e ARCH=aarch64 multiarch/alpine:aarch64-latest-stable /tmp/build.sh +# docker run --rm -v $(pwd):/tmp -w /tmp -e ARCH=ARCH_HERE ALPINE_IMAGE_HERE /tmp/build.sh CURL_VERSION='7.73.0' -[ "$1" != ""] && CURL_VERSION="$1" +[ "$1" != "" ] && CURL_VERSION="$1" set -exu -# change to the directory this script is in, we assume mykey.asc is there -cd "$(dirname "$0")" - if [ ! -f curl-${CURL_VERSION}.tar.gz ] then @@ -63,5 +59,8 @@ ldd src/curl || true #./src/curl -v http://www.moparisthebest.com/; ./src/curl -v https://www.moparisthebest.com/ip -# we only want to save curl here, by moving it to /tmp/ for now -mv src/curl /tmp/ +# we only want to save curl here +mkdir -p /tmp/release/ +mv src/curl "/tmp/release/curl-$ARCH" +cd .. +rm -rf "curl-${CURL_VERSION}/" diff --git a/docker_build.sh b/docker_build.sh deleted file mode 100755 index a16b16d..0000000 --- a/docker_build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -DOCKER_IMAGE="$1" -shift -ARCH="$1" - -BUILD_DIR=/tmp/static-curl/ - -rm -rf "$BUILD_DIR" -mkdir -p "$BUILD_DIR" -cp build.sh mykey.asc "$BUILD_DIR" - -# if this is a multiarch image, must register binfmt handlers -echo "$DOCKER_IMAGE" | grep multiarch && docker run --rm --privileged multiarch/qemu-user-static:register --reset - -docker run --rm -v "$BUILD_DIR":/tmp "$DOCKER_IMAGE" /tmp/build.sh || exit 1 - -mv "$BUILD_DIR"curl "./curl-$ARCH" -rm -rf "$BUILD_DIR" 2>/dev/null - -exit 0