Skip to content

Commit 9a849d2

Browse files
Bot Updating Templated Files
1 parent 087ee7e commit 9a849d2

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' ''',
@@ -280,6 +280,9 @@ pipeline {
280280
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
281281
sh "docker tag ${IMAGE}:arm32v6-${META_TAG} lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
282282
sh "docker push lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER}"
283+
sh '''docker rmi \
284+
${IMAGE}:arm32v6-${META_TAG} \
285+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} '''
283286
}
284287
}
285288
}
@@ -306,6 +309,9 @@ pipeline {
306309
--build-arg ${BUILD_VERSION_ARG}=${EXT_RELEASE} --build-arg VERSION=\"${META_TAG}\" --build-arg BUILD_DATE=${GITHUB_DATE} ."
307310
sh "docker tag ${IMAGE}:arm64v8-${META_TAG} lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
308311
sh "docker push lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER}"
312+
sh '''docker rmi \
313+
${IMAGE}:arm64v8-${META_TAG} \
314+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
309315
}
310316
}
311317
}
@@ -335,7 +341,7 @@ pipeline {
335341
chmod 777 /tmp/package_versions.txt'
336342
elif [ "${DIST_IMAGE}" == "ubuntu" ]; then
337343
docker run --rm --entrypoint '/bin/sh' -v ${TEMPDIR}:/tmp ${LOCAL_CONTAINER} -c '\
338-
apt list -qq --installed > /tmp/package_versions.txt && \
344+
apt list -qq --installed | cut -d" " -f1-2 > /tmp/package_versions.txt && \
339345
chmod 777 /tmp/package_versions.txt'
340346
fi
341347
NEW_PACKAGE_TAG=$(md5sum ${TEMPDIR}/package_versions.txt | cut -c1-8 )
@@ -467,6 +473,10 @@ pipeline {
467473
sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest"
468474
sh "docker push ${IMAGE}:latest"
469475
sh "docker push ${IMAGE}:${META_TAG}"
476+
sh '''docker rmi \
477+
${IMAGE}:${META_TAG} \
478+
${IMAGE}:latest '''
479+
470480
}
471481
}
472482
}
@@ -514,6 +524,15 @@ pipeline {
514524
sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8"
515525
sh "docker manifest push --purge ${IMAGE}:latest"
516526
sh "docker manifest push --purge ${IMAGE}:${META_TAG}"
527+
sh '''docker rmi \
528+
${IMAGE}:amd64-${META_TAG} \
529+
${IMAGE}:amd64-latest \
530+
${IMAGE}:arm32v6-${META_TAG} \
531+
${IMAGE}:arm32v6-latest \
532+
${IMAGE}:arm64v8-${META_TAG} \
533+
${IMAGE}:arm64v8-latest \
534+
lsiodev/buildcache:arm32v6-${COMMIT_SHA}-${BUILD_NUMBER} \
535+
lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} '''
517536
}
518537
}
519538
}
@@ -574,6 +593,18 @@ pipeline {
574593
}
575594
}
576595
}
596+
// If this is a Pull request send the CI link as a comment on it
597+
stage('Pull Request Comment') {
598+
when {
599+
not {environment name: 'CHANGE_ID', value: ''}
600+
environment name: 'CI', value: 'true'
601+
environment name: 'EXIT_STATUS', value: ''
602+
}
603+
steps {
604+
sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/issues/${PULL_REQUEST}/comments \
605+
-d '{"body": "I am a bot, here are the test results for this PR '${CI_URL}'"}' '''
606+
}
607+
}
577608
}
578609
/* ######################
579610
Send status to Discord

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Here are some example snippets to help you get started creating a container.
5151
```
5252
docker create \
5353
--name=oscam \
54-
-e PUID=1001 \
55-
-e PGID=1001 \
54+
-e PUID=1000 \
55+
-e PGID=1000 \
5656
-e TZ=Europe/London \
5757
-p 8888:8888 \
5858
-v <path to data>:/config \
@@ -95,16 +95,15 @@ services:
9595
image: linuxserver/oscam
9696
container_name: oscam
9797
environment:
98-
- PUID=1001
99-
- PGID=1001
98+
- PUID=1000
99+
- PGID=1000
100100
- TZ=Europe/London
101101
volumes:
102102
- <path to data>:/config
103103
ports:
104104
- 8888:8888
105105
devices:
106106
- /dev/ttyUSB0:/dev/ttyUSB0
107-
mem_limit: 4096m
108107
restart: unless-stopped
109108
```
110109

@@ -115,8 +114,8 @@ Container images are configured using parameters passed at runtime (such as thos
115114
| Parameter | Function |
116115
| :----: | --- |
117116
| `-p 8888` | WebUI |
118-
| `-e PUID=1001` | for UserID - see below for explanation |
119-
| `-e PGID=1001` | for GroupID - see below for explanation |
117+
| `-e PUID=1000` | for UserID - see below for explanation |
118+
| `-e PGID=1000` | for GroupID - see below for explanation |
120119
| `-e TZ=Europe/London` | Specify a timezone to use EG Europe/London. |
121120
| `-v /config` | Where oscam should store config files and logs. |
122121
| `--device /dev/ttyUSB0` | For passing through smart card readers. |
@@ -127,11 +126,11 @@ When using volumes (`-v` flags) permissions issues can arise between the host OS
127126

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

130-
In this instance `PUID=1001` and `PGID=1001`, to find yours use `id user` as below:
129+
In this instance `PUID=1000` and `PGID=1000`, to find yours use `id user` as below:
131130

132131
```
133132
$ id username
134-
uid=1001(dockeruser) gid=1001(dockergroup) groups=1001(dockergroup)
133+
uid=1000(dockeruser) gid=1000(dockergroup) groups=1000(dockergroup)
135134
```
136135

137136

@@ -166,9 +165,20 @@ Below are the instructions for updating containers:
166165
* Start the new container: `docker start oscam`
167166
* You can also remove the old dangling images: `docker image prune`
168167

168+
### Via Taisun auto-updater (especially useful if you don't remember the original parameters)
169+
* Pull the latest image at its tag and replace it with the same env variables in one shot:
170+
```
171+
docker run --rm \
172+
-v /var/run/docker.sock:/var/run/docker.sock taisun/updater \
173+
--oneshot oscam
174+
```
175+
* You can also remove the old dangling images: `docker image prune`
176+
169177
### Via Docker Compose
170-
* Update the image: `docker-compose pull linuxserver/oscam`
171-
* Let compose update containers as necessary: `docker-compose up -d`
178+
* Update all images: `docker-compose pull`
179+
* or update a single image: `docker-compose pull oscam`
180+
* Let compose update all containers as necessary: `docker-compose up -d`
181+
* or update a single container: `docker-compose up -d oscam`
172182
* You can also remove the old dangling images: `docker image prune`
173183

174184
## Versions

0 commit comments

Comments
 (0)