Skip to content

Commit 6bf1eb5

Browse files
aptalcathelamer
authored andcommitted
create development builds
1 parent e65bcbf commit 6bf1eb5

File tree

5 files changed

+62
-62
lines changed

5 files changed

+62
-62
lines changed

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ RUN \
1414
apt-get update && \
1515
apt-get install -y \
1616
git \
17+
jq \
1718
nano \
1819
net-tools \
1920
sudo && \
2021
echo "**** install code-server ****" && \
2122
if [ -z ${CODE_RELEASE+x} ]; then \
22-
CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases/latest" \
23-
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
23+
CODE_RELEASE=$(curl -sX GET "https://api.github.com/repos/cdr/code-server/releases" \
24+
| jq -r 'first(.[] | select(.prerelease == true)) | .tag_name'); \
2425
fi && \
2526
curl -o \
2627
/tmp/code.tar.gz -L \
27-
"https://github.com/cdr/code-server/releases/download/${CODE_RELEASE}/code-server${CODE_RELEASE}-linux-x64.tar.gz" && \
28+
"https://github.com/cdr/code-server/releases/download/${CODE_RELEASE}/code-server${CODE_RELEASE}-linux-x86_64.tar.gz" && \
2829
tar xzf /tmp/code.tar.gz -C \
2930
/usr/bin/ --strip-components=1 \
3031
--wildcards code-server*/code-server && \

Jenkinsfile

+42-50
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ pipeline {
1010
environment {
1111
BUILDS_DISCORD=credentials('build_webhook_url')
1212
GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab')
13-
EXT_GIT_BRANCH = 'master'
14-
EXT_USER = 'cdr'
15-
EXT_REPO = 'code-server'
13+
JSON_URL = 'https://api.github.com/repos/cdr/code-server/releases'
14+
JSON_PATH = 'first(.[] | select(.prerelease == true)) | .tag_name'
1615
CONTAINER_NAME = 'code-server'
1716
BUILD_VERSION_ARG = 'CODE_RELEASE'
1817
LS_USER = 'linuxserver'
@@ -38,7 +37,7 @@ pipeline {
3837
script{
3938
env.EXIT_STATUS = ''
4039
env.LS_RELEASE = sh(
41-
script: '''docker run --rm alexeiled/skopeo sh -c 'skopeo inspect docker://docker.io/'${DOCKERHUB_IMAGE}':latest 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''',
40+
script: '''docker run --rm alexeiled/skopeo sh -c 'skopeo inspect docker://docker.io/'${DOCKERHUB_IMAGE}':development 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''',
4241
returnStdout: true).trim()
4342
env.LS_RELEASE_NOTES = sh(
4443
script: '''cat readme-vars.yml | awk -F \\" '/date: "[0-9][0-9].[0-9][0-9].[0-9][0-9]:/ {print $4;exit;}' | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
@@ -110,21 +109,14 @@ pipeline {
110109
/* ########################
111110
External Release Tagging
112111
######################## */
113-
// If this is a stable github release use the latest endpoint from github to determine the ext tag
114-
stage("Set ENV github_stable"){
112+
// If this is a custom json endpoint parse the return to get external tag
113+
stage("Set ENV custom_json"){
115114
steps{
116115
script{
117116
env.EXT_RELEASE = sh(
118-
script: '''curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq -r '. | .tag_name' ''',
117+
script: '''curl -s ${JSON_URL} | jq -r ". | ${JSON_PATH}" ''',
119118
returnStdout: true).trim()
120-
}
121-
}
122-
}
123-
// If this is a stable or devel github release generate the link for the build message
124-
stage("Set ENV github_link"){
125-
steps{
126-
script{
127-
env.RELEASE_LINK = 'https://github.com/' + env.EXT_USER + '/' + env.EXT_REPO + '/releases/tag/' + env.EXT_RELEASE
119+
env.RELEASE_LINK = env.JSON_URL
128120
}
129121
}
130122
}
@@ -138,10 +130,10 @@ pipeline {
138130
}
139131
}
140132
}
141-
// If this is a master build use live docker endpoints
133+
// If this is a development build use live docker endpoints
142134
stage("Set ENV live build"){
143135
when {
144-
branch "master"
136+
branch "development"
145137
environment name: 'CHANGE_ID', value: ''
146138
}
147139
steps {
@@ -159,7 +151,7 @@ pipeline {
159151
// If this is a dev build use dev docker endpoints
160152
stage("Set ENV dev build"){
161153
when {
162-
not {branch "master"}
154+
not {branch "development"}
163155
environment name: 'CHANGE_ID', value: ''
164156
}
165157
steps {
@@ -226,7 +218,7 @@ pipeline {
226218
// Use helper containers to render templated files
227219
stage('Update-Templates') {
228220
when {
229-
branch "master"
221+
branch "development"
230222
environment name: 'CHANGE_ID', value: ''
231223
expression {
232224
env.CONTAINER_NAME != null
@@ -237,16 +229,16 @@ pipeline {
237229
set -e
238230
TEMPDIR=$(mktemp -d)
239231
docker pull linuxserver/jenkins-builder:latest
240-
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest
232+
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=development -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest
241233
docker pull linuxserver/doc-builder:latest
242-
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest
234+
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=development -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest
243235
if [ "$(md5sum ${TEMPDIR}/${LS_REPO}/Jenkinsfile | awk '{ print $1 }')" != "$(md5sum Jenkinsfile | awk '{ print $1 }')" ] || \
244236
[ "$(md5sum ${TEMPDIR}/${CONTAINER_NAME}/README.md | awk '{ print $1 }')" != "$(md5sum README.md | awk '{ print $1 }')" ] || \
245237
[ "$(cat ${TEMPDIR}/${LS_REPO}/LICENSE | md5sum | cut -c1-8)" != "${LICENSE_TAG}" ] || \
246238
[ "$(cat ${TEMPDIR}/${LS_REPO}/.github/FUNDING.yml | md5sum | cut -c1-8)" != "${FUNDING_TAG}" ]; then
247239
mkdir -p ${TEMPDIR}/repo
248240
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
249-
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git checkout -f master
241+
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git checkout -f development
250242
cp ${TEMPDIR}/${CONTAINER_NAME}/README.md ${TEMPDIR}/repo/${LS_REPO}/
251243
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
252244
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/LICENSE ${TEMPDIR}/repo/${LS_REPO}/
@@ -280,7 +272,7 @@ pipeline {
280272
// Exit the build if the Templated files were just updated
281273
stage('Template-exit') {
282274
when {
283-
branch "master"
275+
branch "development"
284276
environment name: 'CHANGE_ID', value: ''
285277
environment name: 'FILES_UPDATED', value: 'true'
286278
expression {
@@ -379,7 +371,7 @@ pipeline {
379371
// Take the image we just built and dump package versions for comparison
380372
stage('Update-packages') {
381373
when {
382-
branch "master"
374+
branch "development"
383375
environment name: 'CHANGE_ID', value: ''
384376
environment name: 'EXIT_STATUS', value: ''
385377
}
@@ -407,7 +399,7 @@ pipeline {
407399
echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github"
408400
if [ "${NEW_PACKAGE_TAG}" != "${PACKAGE_TAG}" ]; then
409401
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO}
410-
git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f master
402+
git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f development
411403
cp ${TEMPDIR}/package_versions.txt ${TEMPDIR}/${LS_REPO}/
412404
cd ${TEMPDIR}/${LS_REPO}/
413405
wait
@@ -431,7 +423,7 @@ pipeline {
431423
// Exit the build if the package file was just updated
432424
stage('PACKAGE-exit') {
433425
when {
434-
branch "master"
426+
branch "development"
435427
environment name: 'CHANGE_ID', value: ''
436428
environment name: 'PACKAGE_UPDATED', value: 'true'
437429
environment name: 'EXIT_STATUS', value: ''
@@ -445,7 +437,7 @@ pipeline {
445437
// Exit the build if this is just a package check and there are no changes to push
446438
stage('PACKAGECHECK-exit') {
447439
when {
448-
branch "master"
440+
branch "development"
449441
environment name: 'CHANGE_ID', value: ''
450442
environment name: 'PACKAGE_UPDATED', value: 'false'
451443
environment name: 'EXIT_STATUS', value: ''
@@ -530,12 +522,12 @@ pipeline {
530522
sh '''#! /bin/bash
531523
echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin
532524
'''
533-
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
534-
sh "docker push ${IMAGE}:latest"
525+
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:development"
526+
sh "docker push ${IMAGE}:development"
535527
sh "docker push ${IMAGE}:${META_TAG}"
536528
sh '''docker rmi \
537529
${IMAGE}:${META_TAG} \
538-
${IMAGE}:latest || :'''
530+
${IMAGE}:development || :'''
539531

540532
}
541533
}
@@ -565,32 +557,32 @@ pipeline {
565557
docker tag lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v7-${META_TAG}
566558
docker tag lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG}
567559
fi'''
568-
sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-latest"
569-
sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm32v7-latest"
570-
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-latest"
560+
sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-development"
561+
sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm32v7-development"
562+
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-development"
571563
sh "docker push ${IMAGE}:amd64-${META_TAG}"
572564
sh "docker push ${IMAGE}:arm32v7-${META_TAG}"
573565
sh "docker push ${IMAGE}:arm64v8-${META_TAG}"
574-
sh "docker push ${IMAGE}:amd64-latest"
575-
sh "docker push ${IMAGE}:arm32v7-latest"
576-
sh "docker push ${IMAGE}:arm64v8-latest"
577-
sh "docker manifest push --purge ${IMAGE}:latest || :"
578-
sh "docker manifest create ${IMAGE}:latest ${IMAGE}:amd64-latest ${IMAGE}:arm32v7-latest ${IMAGE}:arm64v8-latest"
579-
sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm32v7-latest --os linux --arch arm"
580-
sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8"
566+
sh "docker push ${IMAGE}:amd64-development"
567+
sh "docker push ${IMAGE}:arm32v7-development"
568+
sh "docker push ${IMAGE}:arm64v8-development"
569+
sh "docker manifest push --purge ${IMAGE}:development || :"
570+
sh "docker manifest create ${IMAGE}:development ${IMAGE}:amd64-development ${IMAGE}:arm32v7-development ${IMAGE}:arm64v8-development"
571+
sh "docker manifest annotate ${IMAGE}:development ${IMAGE}:arm32v7-development --os linux --arch arm"
572+
sh "docker manifest annotate ${IMAGE}:development ${IMAGE}:arm64v8-development --os linux --arch arm64 --variant v8"
581573
sh "docker manifest push --purge ${IMAGE}:${META_TAG} || :"
582574
sh "docker manifest create ${IMAGE}:${META_TAG} ${IMAGE}:amd64-${META_TAG} ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm64v8-${META_TAG}"
583575
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm32v7-${META_TAG} --os linux --arch arm"
584576
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
585-
sh "docker manifest push --purge ${IMAGE}:latest"
577+
sh "docker manifest push --purge ${IMAGE}:development"
586578
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
587579
sh '''docker rmi \
588580
${IMAGE}:amd64-${META_TAG} \
589-
${IMAGE}:amd64-latest \
581+
${IMAGE}:amd64-development \
590582
${IMAGE}:arm32v7-${META_TAG} \
591-
${IMAGE}:arm32v7-latest \
583+
${IMAGE}:arm32v7-development \
592584
${IMAGE}:arm64v8-${META_TAG} \
593-
${IMAGE}:arm64v8-latest \
585+
${IMAGE}:arm64v8-development \
594586
lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} \
595587
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || :'''
596588
}
@@ -599,7 +591,7 @@ pipeline {
599591
// If this is a public release tag it in the LS Github
600592
stage('Github-Tag-Push-Release') {
601593
when {
602-
branch "master"
594+
branch "development"
603595
expression {
604596
env.LS_RELEASE != env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER
605597
}
@@ -611,17 +603,17 @@ pipeline {
611603
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \
612604
-d '{"tag":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\
613605
"object": "'${COMMIT_SHA}'",\
614-
"message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to master",\
606+
"message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to development",\
615607
"type": "commit",\
616608
"tagger": {"name": "LinuxServer Jenkins","email": "[email protected]","date": "'${GITHUB_DATE}'"}}' '''
617609
echo "Pushing New release for Tag"
618610
sh '''#! /bin/bash
619-
curl -s https://api.github.com/repos/${EXT_USER}/${EXT_REPO}/releases/latest | jq '. |.body' | sed 's:^.\\(.*\\).$:\\1:' > releasebody.json
611+
echo "Data change at JSON endpoint ${JSON_URL}" > releasebody.json
620612
echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\
621-
"target_commitish": "master",\
613+
"target_commitish": "development",\
622614
"name": "'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\
623-
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**'${EXT_REPO}' Changes:**\\n\\n' > start
624-
printf '","draft": false,"prerelease": false}' >> releasebody.json
615+
"body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Remote Changes:**\\n\\n' > start
616+
printf '","draft": false,"prerelease": true}' >> releasebody.json
625617
paste -d'\\0' start releasebody.json > releasebody.json.done
626618
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
627619
}

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ The architectures supported by this image are:
5454
| :----: | --- |
5555
| x86-64 | amd64-latest |
5656

57+
## Version Tags
58+
59+
This image provides various versions that are available via tags. `latest` tag usually provides the latest stable version. Others are considered under development and caution must be exercised when using them.
60+
61+
| Tag | Description |
62+
| :----: | --- |
63+
| latest | Stable releases |
64+
| development | Prereleases from their GitHub |
5765

5866
## Usage
5967

jenkins-vars.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
# jenkins variables
44
project_name: docker-code-server
5-
external_type: github_stable
6-
release_type: stable
7-
release_tag: latest
8-
ls_branch: master
5+
external_type: custom_json
6+
release_type: prerelease
7+
release_tag: development
8+
ls_branch: development
99
repo_vars:
10-
- EXT_GIT_BRANCH = 'master'
11-
- EXT_USER = 'cdr'
12-
- EXT_REPO = 'code-server'
10+
- JSON_URL = 'https://api.github.com/repos/cdr/code-server/releases'
11+
- JSON_PATH = 'first(.[] | select(.prerelease == true)) | .tag_name'
1312
- CONTAINER_NAME = 'code-server'
1413
- BUILD_VERSION_ARG = 'CODE_RELEASE'
1514
- LS_USER = 'linuxserver'

readme-vars.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ available_architectures:
2424
- { arch: "{{ arch_x86_64 }}", tag: "amd64-latest"}
2525

2626
# development version
27-
development_versions: false
27+
development_versions: true
2828
development_versions_items:
2929
- { tag: "latest", desc: "Stable releases" }
30-
- { tag: "development", desc: "Releases from the `develop` branch" }
30+
- { tag: "development", desc: "Prereleases from their GitHub" }
3131

3232
# container parameters
3333
common_param_env_vars_enabled: true

0 commit comments

Comments
 (0)