mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2024-11-21 12:17:17 +03:00
Add opencontainer labels to container (#195)
Closes: forgejo/runner#162 Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/195 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
parent
c989385713
commit
15e328a8a5
4 changed files with 40 additions and 2 deletions
24
.forgejo/labelscompare.py
Normal file
24
.forgejo/labelscompare.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import json
|
||||||
|
|
||||||
|
expectedLabels = {
|
||||||
|
"maintainer": "contact@forgejo.org",
|
||||||
|
"org.opencontainers.image.authors": "Forgejo",
|
||||||
|
"org.opencontainers.image.url": "https://forgejo.org",
|
||||||
|
"org.opencontainers.image.documentation": "https://forgejo.org/docs/latest/admin/actions/#forgejo-runner",
|
||||||
|
"org.opencontainers.image.source": "https://code.forgejo.org/forgejo/runner",
|
||||||
|
"org.opencontainers.image.version": "1.2.3",
|
||||||
|
"org.opencontainers.image.vendor": "Forgejo",
|
||||||
|
"org.opencontainers.image.licenses": "MIT",
|
||||||
|
"org.opencontainers.image.title": "Forgejo Runner",
|
||||||
|
"org.opencontainers.image.description": "A runner for Forgejo Actions.",
|
||||||
|
}
|
||||||
|
inspect = None
|
||||||
|
with open("./labels.json", "r") as f:
|
||||||
|
inspect = json.load(f)
|
||||||
|
|
||||||
|
assert inspect
|
||||||
|
labels = inspect[0]["Config"]["Labels"]
|
||||||
|
|
||||||
|
for k, v in expectedLabels.items():
|
||||||
|
assert k in labels, f"'{k}' is missing from labels"
|
||||||
|
assert labels[k] == v, f"expected {v} in key {k}, found {labels[k]}"
|
|
@ -85,3 +85,6 @@ jobs:
|
||||||
done
|
done
|
||||||
|
|
||||||
docker pull ${{ steps.forgejo.outputs.host-port }}/root/runner:$version
|
docker pull ${{ steps.forgejo.outputs.host-port }}/root/runner:$version
|
||||||
|
|
||||||
|
docker inspect ${{ steps.forgejo.outputs.host-port}}/root/runner:$version > labels.json
|
||||||
|
python3 .forgejo/labelscompare.py
|
||||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -20,12 +20,22 @@ WORKDIR /srv
|
||||||
RUN make clean && make build
|
RUN make clean && make build
|
||||||
|
|
||||||
FROM docker.io/library/alpine:3.18
|
FROM docker.io/library/alpine:3.18
|
||||||
LABEL maintainer="contact@forgejo.org"
|
ARG RELEASE_VERSION
|
||||||
|
|
||||||
RUN apk add --no-cache git bash
|
RUN apk add --no-cache git bash
|
||||||
|
|
||||||
COPY --from=build-env /srv/forgejo-runner /bin/forgejo-runner
|
COPY --from=build-env /srv/forgejo-runner /bin/forgejo-runner
|
||||||
|
|
||||||
|
LABEL maintainer="contact@forgejo.org" \
|
||||||
|
org.opencontainers.image.authors="Forgejo" \
|
||||||
|
org.opencontainers.image.url="https://forgejo.org" \
|
||||||
|
org.opencontainers.image.documentation="https://forgejo.org/docs/latest/admin/actions/#forgejo-runner" \
|
||||||
|
org.opencontainers.image.source="https://code.forgejo.org/forgejo/runner" \
|
||||||
|
org.opencontainers.image.version="${RELEASE_VERSION}" \
|
||||||
|
org.opencontainers.image.vendor="Forgejo" \
|
||||||
|
org.opencontainers.image.licenses="MIT" \
|
||||||
|
org.opencontainers.image.title="Forgejo Runner" \
|
||||||
|
org.opencontainers.image.description="A runner for Forgejo Actions."
|
||||||
|
|
||||||
ENV HOME=/data
|
ENV HOME=/data
|
||||||
|
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
* [Fix the docker compose example](https://code.forgejo.org/forgejo/runner/pulls/175) to workaround the race on labels.
|
* [Fix the docker compose example](https://code.forgejo.org/forgejo/runner/pulls/175) to workaround the race on labels.
|
||||||
* [Fix the kubernetes dind example](https://code.forgejo.org/forgejo/runner/pulls/169).
|
* [Fix the kubernetes dind example](https://code.forgejo.org/forgejo/runner/pulls/169).
|
||||||
* [Rewrite ::group:: and ::endgroup:: commands like github](https://code.forgejo.org/forgejo/runner/pulls/183).
|
* [Rewrite ::group:: and ::endgroup:: commands like github](https://code.forgejo.org/forgejo/runner/pulls/183).
|
||||||
|
* [Added opencontainers labels to the image](https://code.forgejo.org/forgejo/runner/pulls/195)
|
||||||
|
|
||||||
## 3.4.1
|
## 3.4.1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue