Skip to content
This repository was archived by the owner on Jun 15, 2021. It is now read-only.

Commit 4ad5a00

Browse files
Bot Updating Templated Files
1 parent 68a3370 commit 4ad5a00

File tree

2 files changed

+54
-13
lines changed

2 files changed

+54
-13
lines changed

Jenkinsfile

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pipeline {
3838
script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''',
3939
returnStdout: true).trim()
4040
env.LS_RELEASE_NOTES = sh(
41-
script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
41+
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' ''',
4242
returnStdout: true).trim()
4343
env.GITHUB_DATE = sh(
4444
script: '''date '+%Y-%m-%dT%H:%M:%S%:z' ''',
@@ -282,6 +282,9 @@ pipeline {
282282
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
283283
sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
284284
sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
285+
sh '''docker rmi \
286+
${IMAGE}:arm32v6-${META_TAG} \
287+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} '''
285288
}
286289
}
287290
}
@@ -308,6 +311,9 @@ pipeline {
308311
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
309312
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
310313
sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
314+
sh '''docker rmi \
315+
${IMAGE}:arm64v8-${META_TAG} \
316+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
311317
}
312318
}
313319
}
@@ -337,7 +343,7 @@ pipeline {
337343
chmod 777 /tmp/package_versions.txt'
338344
elif [ "${DIST_IMAGE}" == "ubuntu" ]; then
339345
docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
340-
apt list -qq --installed > /tmp/package_versions.txt && \
346+
apt list -qq --installed | cut -d" " -f1-2 > /tmp/package_versions.txt && \
341347
chmod 777 /tmp/package_versions.txt'
342348
fi
343349
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
@@ -469,6 +475,10 @@ pipeline {
469475
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
470476
sh "docker push ${IMAGE}:latest"
471477
sh "docker push ${IMAGE}:${META_TAG}"
478+
sh '''docker rmi \
479+
${IMAGE}:${META_TAG} \
480+
${IMAGE}:latest '''
481+
472482
}
473483
}
474484
}
@@ -516,6 +526,15 @@ pipeline {
516526
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
517527
sh "docker manifest push --purge ${IMAGE}:latest"
518528
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
529+
sh '''docker rmi \
530+
${IMAGE}:amd64-${META_TAG} \
531+
${IMAGE}:amd64-latest \
532+
${IMAGE}:arm32v6-${META_TAG} \
533+
${IMAGE}:arm32v6-latest \
534+
${IMAGE}:arm64v8-${META_TAG} \
535+
${IMAGE}:arm64v8-latest \
536+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} \
537+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
519538
}
520539
}
521540
}
@@ -576,6 +595,18 @@ pipeline {
576595
}
577596
}
578597
}
598+
// If this is a Pull request send the CI link as a comment on it
599+
stage('Pull Request Comment') {
600+
when {
601+
not {environment name: 'CHANGE_ID', value: ''}
602+
environment name: 'CI', value: 'true'
603+
environment name: 'EXIT_STATUS', value: ''
604+
}
605+
steps {
606+
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
607+
-d '{"body": "I am a bot, here are the test results for this PR '${CI_URL}'"}' '''
608+
}
609+
}
579610
}
580611
/* ######################
581612
Send status to Discord

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Here are some example snippets to help you get started creating a container.
5050
docker create \
5151
--name=openvpn-as \
5252
--cap-add=NET_ADMIN \
53-
-e PUID=1001 \
54-
-e PGID=1001 \
53+
-e PUID=1000 \
54+
-e PGID=1000 \
5555
-e TZ=Europe/London \
5656
-e INTERFACE=eth0 `#optional` \
5757
-p 943:943 \
@@ -77,8 +77,8 @@ services:
7777
cap_add:
7878
- NET_ADMIN
7979
environment:
80-
- PUID=1001
81-
- PGID=1001
80+
- PUID=1000
81+
- PGID=1000
8282
- TZ=Europe/London
8383
- INTERFACE=eth0 #optional
8484
volumes:
@@ -87,7 +87,6 @@ services:
8787
- 943:943
8888
- 9443:9443
8989
- 1194:1194/udp
90-
mem_limit: 4096m
9190
restart: unless-stopped
9291
```
9392

@@ -100,8 +99,8 @@ Container images are configured using parameters passed at runtime (such as thos
10099
| `-p 943` | Admin GUI port. |
101100
| `-p 9443` | TCP port. |
102101
| `-p 1194/udp` | UDP port. |
103-
| `-e PUID=1001` | for UserID - see below for explanation |
104-
| `-e PGID=1001` | for GroupID - see below for explanation |
102+
| `-e PUID=1000` | for UserID - see below for explanation |
103+
| `-e PGID=1000` | for GroupID - see below for explanation |
105104
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
106105
| `-e INTERFACE=eth0` | With bridge networking, leave it as eth0 (or don't include at all), if host or macvlan, set it to your host's network interface, found by running `ifconfig` |
107106
| `-v /config` | Where openvpn-as should store configuration files. |
@@ -112,11 +111,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
112111

113112
Ensure any volume directories on the host are owned by the same user you specify and any permissions issues will vanish like magic.
114113

115-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
114+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
116115

117116
```
118117
$ id username
119-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
118+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
120119
```
121120

122121

@@ -158,9 +157,20 @@ Below are the instructions for updating containers:
158157
* Start the new container: `docker start openvpn-as`
159158
* You can also remove the old dangling images: `docker image prune`
160159

160+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
161+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
162+
```
163+
docker run --rm \
164+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
165+
--oneshot openvpn-as
166+
```
167+
* You can also remove the old dangling images: `docker image prune`
168+
161169
### Via Docker Compose
162-
* Update the image: `docker-compose pull linuxserver/openvpn-as`
163-
* Let compose update containers as necessary: `docker-compose up -d`
170+
* Update all images: `docker-compose pull`
171+
* or update a single image: `docker-compose pull openvpn-as`
172+
* Let compose update all containers as necessary: `docker-compose up -d`
173+
* or update a single container: `docker-compose up -d openvpn-as`
164174
* You can also remove the old dangling images: `docker image prune`
165175

166176
## Versions

0 commit comments

Comments
 (0)