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

Commit a2a3fb2

Browse files
Bot Updating Templated Files
1 parent d6c585d commit a2a3fb2

File tree

2 files changed

+53
-12
lines changed

2 files changed

+53
-12
lines changed

Jenkinsfile

+32-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pipeline {
3939
script: '''curl -s https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases/latest | jq -r '. | .tag_name' ''',
4040
returnStdout: true).trim()
4141
env.LS_RELEASE_NOTES = sh(
42-
script: '''git log -1 --pretty=%B | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''',
42+
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' ''',
4343
returnStdout: true).trim()
4444
env.GITHUB_DATE = sh(
4545
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
}
@@ -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

+21-11
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Here are some example snippets to help you get started creating a container.
5252
docker create \
5353
--name=letsencrypt \
5454
--cap-add=NET_ADMIN \
55-
-e PUID=1001 \
56-
-e PGID=1001 \
55+
-e PUID=1000 \
56+
-e PGID=1000 \
5757
-e TZ=Europe/London \
5858
-e URL=yourdomain.url \
5959
-e SUBDOMAINS=www, \
@@ -87,8 +87,8 @@ services:
8787
cap_add:
8888
- NET_ADMIN
8989
environment:
90-
- PUID=1001
91-
- PGID=1001
90+
- PUID=1000
91+
- PGID=1000
9292
- TZ=Europe/London
9393
- URL=yourdomain.url
9494
- SUBDOMAINS=www,
@@ -105,7 +105,6 @@ services:
105105
ports:
106106
- 443:443
107107
- 80:80 #optional
108-
mem_limit: 4096m
109108
restart: unless-stopped
110109
```
111110

@@ -117,8 +116,8 @@ Container images are configured using parameters passed at runtime (such as thos
117116
| :----: | --- |
118117
| `-p 443` | Https port |
119118
| `-p 80` | Http port (required for http validation only) |
120-
| `-e PUID=1001` | for UserID - see below for explanation |
121-
| `-e PGID=1001` | for GroupID - see below for explanation |
119+
| `-e PUID=1000` | for UserID - see below for explanation |
120+
| `-e PGID=1000` | for GroupID - see below for explanation |
122121
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
123122
| `-e URL=yourdomain.url` | Top url you have control over (`customdomain.com` if you own it, or `customsubdomain.ddnsprovider.com` if dynamic dns). |
124123
| `-e SUBDOMAINS=www,` | Subdomains you'd like the cert to cover (comma separated, no spaces) ie. `www,ftp,cloud`. For a wildcard cert, set this _exactly_ to `wildcard` (wildcard cert is available via `dns` and `duckdns` validation only) |
@@ -138,11 +137,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
138137

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

141-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
140+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
142141

143142
```
144143
$ id username
145-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
144+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
146145
```
147146

148147

@@ -218,9 +217,20 @@ Below are the instructions for updating containers:
218217
* Start the new container: `docker start letsencrypt`
219218
* You can also remove the old dangling images: `docker image prune`
220219

220+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
221+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
222+
```
223+
docker run --rm \
224+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
225+
--oneshot letsencrypt
226+
```
227+
* You can also remove the old dangling images: `docker image prune`
228+
221229
### Via Docker Compose
222-
* Update the image: `docker-compose pull linuxserver/letsencrypt`
223-
* Let compose update containers as necessary: `docker-compose up -d`
230+
* Update all images: `docker-compose pull`
231+
* or update a single image: `docker-compose pull letsencrypt`
232+
* Let compose update all containers as necessary: `docker-compose up -d`
233+
* or update a single container: `docker-compose up -d letsencrypt`
224234
* You can also remove the old dangling images: `docker image prune`
225235

226236
## Versions

0 commit comments

Comments
 (0)