Skip to content

Commit eb7dbd3

Browse files
authored
Merge pull request #3 from thelamer/master
updating config for pipeline builds adding versioning to dockerfiles
2 parents e6b35d3 + 3adc0bc commit eb7dbd3

File tree

4 files changed

+60
-26
lines changed

4 files changed

+60
-26
lines changed

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM lsiobase/alpine:3.8
33
# set version label
44
ARG BUILD_DATE
55
ARG VERSION
6+
ARG LDAP_VERSION
67
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
78
LABEL maintainer="aptalca"
89

@@ -19,9 +20,14 @@ RUN \
1920
libldap \
2021
py2-pip \
2122
python2 && \
23+
if [ -z ${LDAP_VERSION+x} ]; then \
24+
LDAP_INSTALL="python-ldap"; \
25+
else \
26+
LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \
27+
fi && \
2228
pip install -U --no-cache-dir \
2329
cryptography \
24-
python-ldap && \
30+
${LDAP_INSTALL} && \
2531
echo "**** cleanup ****" && \
2632
apk del --purge \
2733
build-dependencies && \

Dockerfile.aarch64

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM lsiobase/alpine.arm64:3.8
22

3+
# Add qemu to run on x86_64 systems
4+
COPY qemu-aarch64-static /usr/bin
5+
36
# set version label
47
ARG BUILD_DATE
58
ARG VERSION
9+
ARG LDAP_VERSION
610
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
711
LABEL maintainer="aptalca"
812

@@ -19,9 +23,14 @@ RUN \
1923
libldap \
2024
py2-pip \
2125
python2 && \
26+
if [ -z ${LDAP_VERSION+x} ]; then \
27+
LDAP_INSTALL="python-ldap"; \
28+
else \
29+
LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \
30+
fi && \
2231
pip install -U --no-cache-dir \
2332
cryptography \
24-
python-ldap && \
33+
${LDAP_INSTALL} && \
2534
echo "**** cleanup ****" && \
2635
apk del --purge \
2736
build-dependencies && \

Dockerfile.armhf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
FROM lsiobase/alpine.armhf:3.8
22

3+
# Add qemu to run on x86_64 systems
4+
COPY qemu-arm-static /usr/bin
5+
36
# set version label
47
ARG BUILD_DATE
58
ARG VERSION
9+
ARG LDAP_VERSION
610
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
711
LABEL maintainer="aptalca"
812

@@ -19,9 +23,14 @@ RUN \
1923
libldap \
2024
py2-pip \
2125
python2 && \
26+
if [ -z ${LDAP_VERSION+x} ]; then \
27+
LDAP_INSTALL="python-ldap"; \
28+
else \
29+
LDAP_INSTALL="python-ldap==${LDAP_VERSION}"; \
30+
fi && \
2231
pip install -U --no-cache-dir \
2332
cryptography \
24-
python-ldap && \
33+
${LDAP_INSTALL} && \
2534
echo "**** cleanup ****" && \
2635
apk del --purge \
2736
build-dependencies && \

Jenkinsfile

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pipeline {
1010
BUILD_VERSION_ARG = 'LDAP_VERSION'
1111
LS_USER = 'linuxserver'
1212
LS_REPO = 'docker-ldap-auth'
13-
CONTAINER_NAME = 'ldap-auth'
1413
DOCKERHUB_IMAGE = 'linuxserver/ldap-auth'
1514
DEV_DOCKERHUB_IMAGE = 'lsiodev/ldap-auth'
1615
PR_DOCKERHUB_IMAGE = 'lspipepr/ldap-auth'
@@ -91,12 +90,14 @@ pipeline {
9190
/* ########################
9291
External Release Tagging
9392
######################## */
94-
// If this is an os release set release type to none to indicate no external release
95-
stage("Set ENV os"){
93+
// If this is a pip version change set the external release verison and link
94+
stage("Set ENV pip_version"){
9695
steps{
9796
script{
98-
env.EXT_RELEASE = env.PACKAGE_TAG
99-
env.RELEASE_LINK = 'none'
97+
env.EXT_RELEASE = sh(
98+
script: '''curl -sL https://pypi.python.org/pypi/${EXT_PIP}/json |jq -r '. | .info.version' ''',
99+
returnStdout: true).trim()
100+
env.RELEASE_LINK = 'https://pypi.python.org/pypi/' + env.EXT_PIP
100101
}
101102
}
102103
}
@@ -179,7 +180,7 @@ pipeline {
179180
when {
180181
environment name: 'MULTIARCH', value: 'true'
181182
}
182-
stages {
183+
parallel {
183184
stage('Build X86') {
184185
steps {
185186
sh "docker build --no-cache -t ${IMAGE}:amd64-${META_TAG} \
@@ -203,7 +204,7 @@ pipeline {
203204
sh '''#! /bin/bash
204205
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
205206
'''
206-
sh "wget https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static"
207+
sh "curl https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static -o qemu-arm-static"
207208
sh "chmod +x qemu-*"
208209
sh "docker build --no-cache -f Dockerfile.armhf -t ${IMAGE}:arm32v6-${META_TAG} \
209210
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
@@ -229,7 +230,7 @@ pipeline {
229230
sh '''#! /bin/bash
230231
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
231232
'''
232-
sh "wget https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static"
233+
sh "curl https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static -o qemu-aarch64-static"
233234
sh "chmod +x qemu-*"
234235
sh "docker build --no-cache -f Dockerfile.aarch64 -t ${IMAGE}:arm64v8-${META_TAG} \
235236
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
@@ -378,34 +379,26 @@ pipeline {
378379
"tagger": {"name": "LinuxServer Jenkins","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
379380
echo "Pushing New release for Tag"
380381
sh '''#! /bin/bash
381-
echo "Updating base packages to ${PACKAGE_TAG}" > releasebody.json
382+
echo "Updating PIP version of ${EXT_PIP} to ${EXT_RELEASE}" > releasebody.json
382383
echo '{"tag_name":"'${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\
383384
"target_commitish": "master",\
384385
"name": "'${EXT_RELEASE}'-pkg-'${PACKAGE_TAG}'-ls'${LS_TAG_NUMBER}'",\
385-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**OS Changes:**\\n\\n' > start
386+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**PIP Changes:**\\n\\n' > start
386387
printf '","draft": false,"prerelease": false}' >> releasebody.json
387388
paste -d'\\0' start releasebody.json > releasebody.json.done
388389
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
389390
}
390391
}
391-
// Use helper containers to Render push the current README in master to the DockerHub Repo
392-
stage('Sync-README') {
392+
// Use helper container to render a readme from remote and commit if different
393+
stage('Update-README') {
393394
when {
394395
branch "master"
396+
environment name: 'CHANGE_ID', value: ''
395397
expression {
396-
env.LS_RELEASE != env.EXT_RELEASE + '-pkg-' + env.PACKAGE_TAG + '-ls' + env.LS_TAG_NUMBER
398+
env.CONTAINER_NAME != null
397399
}
398-
environment name: 'CHANGE_ID', value: ''
399400
}
400401
steps {
401-
withCredentials([
402-
[
403-
$class: 'UsernamePasswordMultiBinding',
404-
credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
405-
usernameVariable: 'DOCKERUSER',
406-
passwordVariable: 'DOCKERPASS'
407-
]
408-
]) {
409402
sh '''#! /bin/bash
410403
TEMPDIR=$(mktemp -d)
411404
docker pull linuxserver/doc-builder:latest
@@ -418,7 +411,24 @@ pipeline {
418411
git --git-dir ${TEMPDIR}/${LS_REPO}/.git commit -m 'Bot Updating README from template'
419412
git --git-dir ${TEMPDIR}/${LS_REPO}/.git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
420413
fi
421-
rm -Rf ${TEMPDIR}
414+
rm -Rf ${TEMPDIR}'''
415+
}
416+
}
417+
// Use helper container to sync the current README on master to the dockerhub endpoint
418+
stage('Sync-README') {
419+
when {
420+
environment name: 'CHANGE_ID', value: ''
421+
}
422+
steps {
423+
withCredentials([
424+
[
425+
$class: 'UsernamePasswordMultiBinding',
426+
credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207',
427+
usernameVariable: 'DOCKERUSER',
428+
passwordVariable: 'DOCKERPASS'
429+
]
430+
]) {
431+
sh '''#! /bin/bash
422432
docker pull lsiodev/readme-sync
423433
docker run --rm=true \
424434
-e DOCKERHUB_USERNAME=$DOCKERUSER \

0 commit comments

Comments
 (0)