Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac2e2b9a5d | ||
|
|
02418d25e4 | ||
|
|
ca30659d4e | ||
|
|
0bb0b6227b | ||
|
|
b92d9416f7 | ||
|
|
cb7a831054 | ||
|
|
c4dad6b826 | ||
|
|
b431a190e0 | ||
|
|
b89c3a1c85 | ||
|
|
7827dd56fa | ||
|
|
47b2f1d300 | ||
|
|
c56bb17e42 | ||
|
|
28f9ffd8d0 | ||
|
|
a7dc4a3dcc | ||
|
|
fe3e411b16 | ||
|
|
8e83820e40 | ||
|
|
da04c0609f | ||
|
|
a283b1d8d0 | ||
|
|
516f8f96ac | ||
|
|
a43f59ceb9 | ||
|
|
ec64392f58 | ||
|
|
000e4c0e03 | ||
|
|
ccad12634b | ||
|
|
adff5c97f3 | ||
|
|
e44424c8b9 | ||
|
|
f60efe84a9 | ||
|
|
e3f7748492 | ||
|
|
0f2883e196 | ||
|
|
2fc9c11800 | ||
|
|
dafb91bfa3 | ||
|
|
c3c6a4e493 | ||
|
|
087e754f56 | ||
|
|
5b19b8dafa | ||
|
|
f4ac990ab1 | ||
|
|
a3bcbecef1 | ||
|
|
26245f5fb3 | ||
|
|
5a85c6bc92 | ||
|
|
e77cb92da3 | ||
|
|
4b56b45734 | ||
|
|
0a895b9bbe | ||
|
|
b8d4598b96 | ||
|
|
1d440a09e9 | ||
|
|
91be52197d | ||
|
|
650aeba07c | ||
|
|
395d555a98 | ||
|
|
08608da938 | ||
|
|
6b686411c7 | ||
|
|
325fe76ae4 | ||
|
|
a6a57d36ab | ||
|
|
de41bc7f8b | ||
|
|
c253d823a6 | ||
|
|
214b75489b | ||
|
|
2cffdf6b9a | ||
|
|
a779a7f993 | ||
|
|
217117d3bc | ||
|
|
829c6ccd91 | ||
|
|
d414c3a388 | ||
|
|
28cb729624 | ||
|
|
733ff44be5 | ||
|
|
0f9d476978 | ||
|
|
6d189b3bae | ||
|
|
36d8efe0c3 | ||
|
|
9afc3108fc | ||
|
|
cc396abd59 | ||
|
|
e8ff100cc0 | ||
|
|
3d2c69648f | ||
|
|
bc2c03d8c9 | ||
|
|
51125e863e | ||
|
|
18afadab14 | ||
|
|
ab8b9d7e6b | ||
|
|
b9622cc4e7 | ||
|
|
62a7a5f10c | ||
|
|
36f4ed430a | ||
|
|
a257b7ad38 | ||
|
|
ba8c7f86a9 | ||
|
|
cda2ba1fb4 | ||
|
|
8d4afae3d2 | ||
|
|
96aaa5c17c | ||
|
|
5e529f979a | ||
|
|
f6da106489 | ||
|
|
d2a3df72e6 | ||
|
|
133c12574c | ||
|
|
e376daf19c | ||
|
|
e729e6c6d4 | ||
|
|
4064635fcd |
@@ -38,7 +38,7 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
ubuntu_base_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
|
||||
debian_base_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
|
||||
@@ -10,6 +10,10 @@ on:
|
||||
schedule:
|
||||
- cron: '59 23 * * *'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
ubuntu_latest_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -23,12 +27,18 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Update Dockerfile FROM org
|
||||
run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile
|
||||
run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -36,7 +46,7 @@ jobs:
|
||||
file: Dockerfile
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{ env.ORG }}/github-runner:latest
|
||||
tags: ${{ env.ORG }}/github-runner:latest,ghcr.io/${{ github.repository }}:latest
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -59,10 +69,16 @@ jobs:
|
||||
- name: Copy Dockerfile
|
||||
run: cp Dockerfile Dockerfile.ubuntu-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-${{ matrix.release }}/" Dockerfile.ubuntu-${{ matrix.release }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -70,7 +86,7 @@ jobs:
|
||||
file: Dockerfile.ubuntu-${{ matrix.release }}
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{env.ORG}}/github-runner:ubuntu-${{ matrix.release }}
|
||||
tags: ${{env.ORG}}/github-runner:ubuntu-${{ matrix.release }},ghcr.io/${{ github.repository }}:ubuntu-${{ matrix.release }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -93,10 +109,16 @@ jobs:
|
||||
- name: Copy Dockerfile
|
||||
run: cp Dockerfile Dockerfile.debian-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:debian-${{ matrix.release }}/" Dockerfile.debian-${{ matrix.release }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -104,7 +126,7 @@ jobs:
|
||||
file: Dockerfile.debian-${{ matrix.release }}
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{ env.ORG }}/github-runner:debian-${{ matrix.release }}
|
||||
tags: ${{ env.ORG }}/github-runner:debian-${{ matrix.release }},ghcr.io/${{ github.repository }}:debian-${{ matrix.release }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@@ -4,6 +4,10 @@ on:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
name: Create Release
|
||||
@@ -37,12 +41,18 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Update Dockerfile FROM org
|
||||
run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile
|
||||
run: sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:latest/" Dockerfile
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -50,7 +60,7 @@ jobs:
|
||||
file: Dockerfile
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }}
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }},ghcr.io/${{ github.repository }}:${{ env.TAG }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -73,15 +83,19 @@ jobs:
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Available platforms
|
||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||
- name: Copy Dockerfile
|
||||
run: cp Dockerfile Dockerfile.ubuntu-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-${{ matrix.release }}/" Dockerfile.ubuntu-${{ matrix.release }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -89,7 +103,7 @@ jobs:
|
||||
file: Dockerfile.ubuntu-${{ matrix.release }}
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }}-ubuntu-${{ matrix.release }}
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }}-ubuntu-${{ matrix.release }},ghcr.io/${{ github.repository }}:${{ env.TAG }}-ubuntu-${{ matrix.release }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -115,10 +129,16 @@ jobs:
|
||||
- name: Copy Dockerfile
|
||||
run: cp Dockerfile Dockerfile.debian-${{ matrix.release }}; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:debian-${{ matrix.release }}/" Dockerfile.debian-${{ matrix.release }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
@@ -126,7 +146,7 @@ jobs:
|
||||
file: Dockerfile.debian-${{ matrix.release }}
|
||||
pull: true
|
||||
push: true
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }}-debian-${{ matrix.release }}
|
||||
tags: ${{ env.ORG }}/github-runner:${{ env.TAG }}-debian-${{ matrix.release }},ghcr.io/${{ github.repository }}:${{ env.TAG }}-debian-${{ matrix.release }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
name: "Trigger: Push action"
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-python@v3
|
||||
- uses: pre-commit/action@v3.0.0
|
||||
- name: Run ShellCheck
|
||||
uses: ludeeus/action-shellcheck@master
|
||||
@@ -1,9 +1,13 @@
|
||||
repos:
|
||||
- repo: git://github.com/detailyang/pre-commit-shell
|
||||
rev: 1.0.2
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.3.0
|
||||
hooks:
|
||||
- id: shell-lint
|
||||
args: [-e, SC1008]
|
||||
- id: check-yaml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: check-case-conflict
|
||||
- id: check-merge-conflict
|
||||
- id: detect-private-key
|
||||
- repo: https://github.com/stratasan/hadolint-pre-commit
|
||||
rev: cdefcb096e520a6daa9552b1d4636f5f1e1729cd
|
||||
hooks:
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
6/3/2021 (latest)
|
||||
|
||||
* `ORG_RUNNER` is now deprecated in favor of `RUNNER_SCOPE`. If you are currently using `ORG_RUNNER` please drop that in favor of `RUNNER_SCOPE="org"`
|
||||
@@ -0,0 +1,17 @@
|
||||
# Welcome to docker-github-actions-runner contributing guide <!-- omit in toc -->
|
||||
|
||||
Welcome!
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Be kind, research before asking/contributing.
|
||||
|
||||
Please remember that my time is limited and my resources are as well. Solving "nuances" will likely require external contributions but I'm happy to help and guide.
|
||||
|
||||
### Issues
|
||||
|
||||
#### Create a new issue
|
||||
|
||||
If you spot an issue, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can open a new issue using a relevant issue.
|
||||
|
||||
Also use [the wiki](https://github.com/myoung34/docker-github-actions-runner/wiki) and contribute to it
|
||||
+5
-7
@@ -5,7 +5,7 @@ LABEL maintainer="myoung34@my.apsu.edu"
|
||||
ENV AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache
|
||||
RUN mkdir -p /opt/hostedtoolcache
|
||||
|
||||
ARG GH_RUNNER_VERSION="2.293.0"
|
||||
ARG GH_RUNNER_VERSION="2.300.2"
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
@@ -13,15 +13,13 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
WORKDIR /actions-runner
|
||||
COPY install_actions.sh /actions-runner
|
||||
|
||||
# TODO: remove this terrible sed once
|
||||
# https://github.com/actions/runner/pull/1585 is merged or similar
|
||||
RUN chmod +x /actions-runner/install_actions.sh \
|
||||
&& sed -i.bak 's/.\/bin\/installdependencies.sh/wget https:\/\/raw.githubusercontent.com\/myoung34\/runner\/main\/src\/Misc\/layoutbin\/installdependencies.sh -O .\/bin\/installdependencies.sh; bash .\/bin\/installdependencies.sh/g' /actions-runner/install_actions.sh \
|
||||
&& /actions-runner/install_actions.sh ${GH_RUNNER_VERSION} ${TARGETPLATFORM} \
|
||||
&& rm /actions-runner/install_actions.sh
|
||||
&& rm /actions-runner/install_actions.sh \
|
||||
&& chown runner /_work /actions-runner /opt/hostedtoolcache
|
||||
|
||||
COPY token.sh entrypoint.sh /
|
||||
RUN chmod +x /token.sh /entrypoint.sh
|
||||
COPY token.sh entrypoint.sh app_token.sh /
|
||||
RUN chmod +x /token.sh /entrypoint.sh /app_token.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["./bin/Runner.Listener", "run", "--startuptype", "service"]
|
||||
|
||||
+23
-12
@@ -1,16 +1,17 @@
|
||||
FROM ubuntu:jammy
|
||||
FROM ubuntu:focal
|
||||
LABEL maintainer="myoung34@my.apsu.edu"
|
||||
|
||||
ARG DUMB_INIT_VERSION="1.2.2"
|
||||
ARG GIT_CORE_PPA_KEY="A1715D88E1DF1F24"
|
||||
|
||||
ENV DOCKER_COMPOSE_VERSION="1.27.4"
|
||||
ENV GIT_LFS_VERSION="3.2.0"
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US.UTF-8
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
# hadolint ignore=DL3003,DL4001,SC2086
|
||||
# hadolint ignore=SC2086,DL3015,DL3008,DL3013
|
||||
RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends gnupg \
|
||||
@@ -22,6 +23,7 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \
|
||||
curl \
|
||||
tar \
|
||||
unzip \
|
||||
zip \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
sudo \
|
||||
@@ -44,26 +46,35 @@ RUN echo en_US.UTF-8 UTF-8 >> /etc/locale.gen \
|
||||
dumb-init \
|
||||
nodejs \
|
||||
rsync \
|
||||
gosu \
|
||||
&& DPKG_ARCH="$(dpkg --print-architecture)" \
|
||||
&& LSB_RELEASE_CODENAME="$(lsb_release --codename | cut -f2)" \
|
||||
&& sed -e 's/Defaults.*env_reset/Defaults env_keep = "HTTP_PROXY HTTPS_PROXY NO_PROXY FTP_PROXY http_proxy https_proxy no_proxy ftp_proxy"/' -i /etc/sudoers \
|
||||
&& echo deb http://ppa.launchpad.net/git-core/ppa/ubuntu $([[ $(grep -E '^ID=' /etc/os-release | sed 's/.*=//g') == "ubuntu" ]] && (grep VERSION_CODENAME /etc/os-release | sed 's/.*=//g') || echo bionic) main>/etc/apt/sources.list.d/git-core.list \
|
||||
&& apt-get update \
|
||||
&& ( apt-get install -y --no-install-recommends git || apt-get install -t stable -y --no-install-recommends git || apt-get install -y --no-install-recommends git=1:2.33.1-0ppa1~ubuntu18.04.1 git-man=1:2.33.1-0ppa1~ubuntu18.04.1 ) \
|
||||
&& ( [[ $(apt-cache search -n liblttng-ust0 | awk '{print $1}') == "liblttng-ust0" ]] && apt-get install -y --no-install-recommends liblttng-ust0 || : ) \
|
||||
&& ( [[ $(apt-cache search -n liblttng-ust1 | awk '{print $1}') == "liblttng-ust1" ]] && apt-get install -y --no-install-recommends liblttng-ust1 || : ) \
|
||||
&& ( ( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip -d /tmp/ && /tmp/aws/install ) || pip3 install awscli ) \
|
||||
# Determine the Distro name (Debian, Ubuntu, etc)
|
||||
&& ( ( curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && unzip awscliv2.zip -d /tmp/ && /tmp/aws/install && rm awscliv2.zip) || pip3 install --no-cache-dir awscli ) \
|
||||
&& ( curl -s "https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-${DPKG_ARCH}-v${GIT_LFS_VERSION}.tar.gz" -L -o /tmp/lfs.tar.gz && tar -xzf /tmp/lfs.tar.gz -C /tmp && /tmp/git-lfs-${GIT_LFS_VERSION}/install.sh && rm -rf /tmp/lfs.tar.gz /tmp/git-lfs-${GIT_LFS_VERSION}) \
|
||||
&& distro=$(lsb_release -is | awk '{print tolower($0)}') \
|
||||
# Determine the Distro version (bullseye, xenial, etc)
|
||||
# Note: sid is aliased to bullseye, because Docker doesn't have a matching apt repo
|
||||
&& mkdir -p /etc/apt/keyrings \
|
||||
&& ( curl -fsSL https://download.docker.com/linux/${distro}/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg ) \
|
||||
&& version=$(lsb_release -cs | awk '{gsub("sid", "bullseye"); print $0}') \
|
||||
&& ( echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${distro} ${version} stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null ) \
|
||||
&& version=$(lsb_release -cs | sed 's/bookworm\|n\/a/bullseye/g') \
|
||||
&& ( echo "deb [arch=${DPKG_ARCH} signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${distro} ${version} stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null ) \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y docker-ce docker-ce-cli containerd.io --no-install-recommends --allow-unauthenticated \
|
||||
&& ( [[ $(lscpu -J | jq -r '.lscpu[] | select(.field == "Vendor ID:") | .data') == "ARM" ]] && echo "Not installing docker-compose. See https://github.com/docker/compose/issues/6831" || ( curl -sL "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose ) ) \
|
||||
&& ( [[ $(lsb_release --codename | cut -f2) == "focal" ]] && ( echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list && curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/Release.key" | apt-key add - && apt-get update) || : ) \
|
||||
&& ( [[ $(lsb_release --codename | cut -f2) == "focal" || $(lsb_release --codename | cut -f2) == "jammy" || $(lsb_release --codename | cut -f2) == "sid" || $(lsb_release --codename | cut -f2) == "bullseye" ]] && apt-get install -y --no-install-recommends podman buildah skopeo || : ) \
|
||||
&& ( [[ $(lsb_release --codename | cut -f2) == "jammy" ]] && echo "Ubuntu Jammy is marked as beta. Please see https://github.com/actions/virtual-environments/issues/5490" || : ) \
|
||||
&& ( [[ "${LSB_RELEASE_CODENAME}" == "focal" ]] && ( echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_20.04/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list && curl -L "https://build.opensuse.org/projects/devel:kubic/public_key" | apt-key add - && apt-get update) || : ) \
|
||||
&& ( [[ "${LSB_RELEASE_CODENAME}" == "focal" || "${LSB_RELEASE_CODENAME}" == "jammy" || "${LSB_RELEASE_CODENAME}" == "sid" || "${LSB_RELEASE_CODENAME}" == "bullseye" ]] && apt-get install -y --no-install-recommends podman buildah skopeo || : ) \
|
||||
&& ( [[ "${LSB_RELEASE_CODENAME}" == "jammy" ]] && echo "Ubuntu Jammy is marked as beta. Please see https://github.com/actions/virtual-environments/issues/5490" || : ) \
|
||||
&& GH_CLI_VERSION=$(curl -sL -H "Accept: application/vnd.github+json" https://api.github.com/repos/cli/cli/releases/latest | jq -r '.tag_name' | sed 's/^v//g') \
|
||||
&& GH_CLI_DOWNLOAD_URL=$(curl -sL -H "Accept: application/vnd.github+json" https://api.github.com/repos/cli/cli/releases/latest | jq ".assets[] | select(.name == \"gh_${GH_CLI_VERSION}_linux_${DPKG_ARCH}.deb\")" | jq -r '.browser_download_url') \
|
||||
&& curl -sSLo /tmp/ghcli.deb ${GH_CLI_DOWNLOAD_URL} && apt-get -y install /tmp/ghcli.deb && rm /tmp/ghcli.deb \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /tmp/*
|
||||
&& rm -rf /tmp/* \
|
||||
&& groupadd -g 121 runner \
|
||||
&& useradd -mr -d /home/runner -u 1001 -g 121 runner \
|
||||
&& usermod -aG sudo runner \
|
||||
&& usermod -aG docker runner \
|
||||
&& echo '%sudo ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
|
||||
@@ -8,12 +8,13 @@ This will run the [new self-hosted github actions runners](https://help.github.c
|
||||
## Quick-Start (Examples and Usage) ##
|
||||
|
||||
Please see [the wiki](https://github.com/myoung34/docker-github-actions-runner/wiki/Usage)
|
||||
Please read [the contributing guidelines](https://github.com/myoung34/docker-github-actions-runner/blob/master/CONTRIBUTING.md)
|
||||
|
||||
## Notes ##
|
||||
|
||||
### Security ###
|
||||
|
||||
It is known that currently tokens (ACCESS_TOKEN / RUNNER_TOKEN ) are not safe from exfiltration.
|
||||
It is known that environment variables are not safe from exfiltration.
|
||||
If you are using this runner make sure that any workflow changes are gated by a verification process (in the actions settings) so that malicious PR's cannot exfiltrate these.
|
||||
|
||||
### Docker Support ###
|
||||
@@ -39,8 +40,8 @@ A workaround exists, please see [here](https://github.com/myoung34/docker-github
|
||||
|
||||
| Container Base | Supported Architectures | Tag Regex | Docker Tags | Description | Notes |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| ubuntu jammy | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+/` | [latest](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=latest) | This is the latest build (Rebuilt nightly and on master merges). Tags without an OS name are included. |
|
||||
| ubuntu focal | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+-ubuntu-focal/` | [ubuntu-focal](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=ubuntu-focal) | This is the latest build from focal (Rebuilt nightly and on master merges). Tags with `-ubuntu-focal` are included and created on [upstream tags](https://github.com/actions/runner/tags). | |
|
||||
| ubuntu focal | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+/` `/\d\.\d{3}\.\d+-ubuntu-focal/`| [latest](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=latest) [ubuntu-focal](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=ubuntu-focal) | This is the latest build (Rebuilt nightly and on master merges). Tags without an OS name are included. Tags with `-ubuntu-focal` are included and created on [upstream tags](https://github.com/actions/runner/tags).|
|
||||
| ubuntu jammy | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+-ubuntu-jammy/` | [ubuntu-jammy](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=ubuntu-jammy) | This is the latest build from jammy (Rebuilt nightly and on master merges). Tags with `-ubuntu-jammy` are included and created on [upstream tags](https://github.com/actions/runner/tags). | There is [currently an issue with jammy from inside a 20.04LTS host](https://github.com/myoung34/docker-github-actions-runner/issues/219) which is why this is not `latest` |
|
||||
| ubuntu bionic | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+-ubuntu-bionic/` | [ubuntu-bionic](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=ubuntu-bionic) | This is the latest build from bionic (Rebuilt nightly and on master merges). Tags with `-ubuntu-bionic` are included and created on [upstream tags](https://github.com/actions/runner/tags). | |
|
||||
| debian buster (now deprecated) | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+-debian-buster/` | [debian-buster](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=debian-buster) | Debian buster is now deprecated. The packages for arm v7 are in flux and are wildly causing build failures (git as well as apt-key and liblttng-ust#. Tags with `-debian-buster` are included and created on [upstream tags](https://github.com/actions/runner/tags). | |
|
||||
| debian bullseye | `x86_64`,`arm64` | `/\d\.\d{3}\.\d+-debian-bullseye/` | [debian-bullseye](https://hub.docker.com/r/myoung34/github-runner/tags?page=1&name=debian-bullseye) | This is the latest build from bullseye (Rebuilt nightly and on master merges). Tags with `-debian-bullseye` are included and created on [upstream tags](https://github.com/actions/runner/tags). | |
|
||||
@@ -52,10 +53,14 @@ These containers are built via Github actions that [copy the dockerfile](https:/
|
||||
|
||||
| Environment Variable | Description |
|
||||
| --- | --- |
|
||||
| `RUN_AS_ROOT` | Boolean to run as root. If `true`: will run as root. If `True` and the user is overridden it will error. If any other value it will run as the `runner` user and allow an optional override. Default is `true` |
|
||||
| `RUNNER_NAME` | The name of the runner to use. Supercedes (overrides) `RUNNER_NAME_PREFIX` |
|
||||
| `RUNNER_NAME_PREFIX` | A prefix for a randomly generated name (followed by a random 13 digit string). You must not also provide `RUNNER_NAME`. Defaults to `github-runner` |
|
||||
| `ACCESS_TOKEN` | A [github PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) to use to generate `RUNNER_TOKEN` dynamically at container start. Not using this requires a valid `RUNNER_TOKEN` |
|
||||
| `RUNNER_SCOPE` | The scope the runner will be registered on. Valid values are `repo`, `org` and `ent`. For 'org' and 'enterprise', `ACCESS_TOKEN` is required and `REPO_URL` is unneccesary. If 'org', requires `ORG_NAME`; if 'enterprise', requires `ENTERPRISE_NAME`. Default is 'repo'. |
|
||||
| `APP_ID` | The github application ID. Must be paired with `APP_PRIVATE_KEY` and should not be used with `ACCESS_TOKEN` or `RUNNER_TOKEN` |
|
||||
| `APP_PRIVATE_KEY` | The github application private key. Must be paired with `APP_ID` and should not be used with `ACCESS_TOKEN` or `RUNNER_TOKEN` |
|
||||
| `APP_LOGIN` | The github application login id. Can be paired with `APP_ID` and `APP_PRIVATE_KEY` if default value extracted from `REPO_URL` or `ORG_NAME` is not correct. Note that no default is present when `RUNNER_SCOPE` is 'enterprise'. |
|
||||
| `RUNNER_SCOPE` | The scope the runner will be registered on. Valid values are `repo`, `org` and `ent`. For 'org' and 'enterprise', `ACCESS_TOKEN` is required and `REPO_URL` is unnecessary. If 'org', requires `ORG_NAME`; if 'enterprise', requires `ENTERPRISE_NAME`. Default is 'repo'. |
|
||||
| `ORG_NAME` | The organization name for the runner to register under. Requires `RUNNER_SCOPE` to be 'org'. No default value. |
|
||||
| `ENTERPRISE_NAME` | The enterprise name for the runner to register under. Requires `RUNNER_SCOPE` to be 'enterprise'. No default value. |
|
||||
| `LABELS` | A comma separated string to indicate the labels. Default is 'default' |
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ If you believe you have found a security vulnerability, please report it to me a
|
||||
|
||||
## Reporting Security Issues
|
||||
|
||||
**Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to me directly at [myoung34@my.apsu.edu](mailto:myoung34@my.apsu.edu).
|
||||
**Please do not report security vulnerabilities through public GitHub issues.** Instead, please report them to me directly at [myoung34@my.apsu.edu](mailto:myoung34@my.apsu.edu).
|
||||
|
||||
If you'd like to communicate securely, my keybase is [here](https://keybase.io/3vilpenguin)
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Request an ACCESS_TOKEN to be used by a GitHub APP
|
||||
# Environment variable that need to be set up:
|
||||
# * APP_ID, the GitHub's app ID
|
||||
# * APP_PRIVATE_KEY, the content of GitHub app's private key in PEM format.
|
||||
# * APP_LOGIN, the login name used to install GitHub's app
|
||||
#
|
||||
# https://github.com/orgs/community/discussions/24743#discussioncomment-3245300
|
||||
#
|
||||
|
||||
set -o pipefail
|
||||
|
||||
_GITHUB_HOST=${GITHUB_HOST:="github.com"}
|
||||
|
||||
# If URL is not github.com then use the enterprise api endpoint
|
||||
if [[ ${GITHUB_HOST} = "github.com" ]]; then
|
||||
URI="https://api.${_GITHUB_HOST}"
|
||||
else
|
||||
URI="https://${_GITHUB_HOST}/api/v3"
|
||||
fi
|
||||
|
||||
API_VERSION=v3
|
||||
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
|
||||
CONTENT_LENGTH_HEADER="Content-Length: 0"
|
||||
APP_INSTALLATIONS_URI="${URI}/app/installations"
|
||||
|
||||
|
||||
# JWT parameters based off
|
||||
# https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app
|
||||
#
|
||||
# JWT token issuance and expiration parameters
|
||||
JWT_IAT_DRIFT=60
|
||||
JWT_EXP_DELTA=600
|
||||
|
||||
JWT_JOSE_HEADER='{
|
||||
"alg": "RS256",
|
||||
"typ": "JWT"
|
||||
}'
|
||||
|
||||
|
||||
build_jwt_payload() {
|
||||
now=$(date +%s)
|
||||
iat=$((now - JWT_IAT_DRIFT))
|
||||
jq -c \
|
||||
--arg iat_str "${iat}" \
|
||||
--arg exp_delta_str "${JWT_EXP_DELTA}" \
|
||||
--arg app_id_str "${APP_ID}" \
|
||||
'
|
||||
($iat_str | tonumber) as $iat
|
||||
| ($exp_delta_str | tonumber) as $exp_delta
|
||||
| ($app_id_str | tonumber) as $app_id
|
||||
| .iat = $iat
|
||||
| .exp = ($iat + $exp_delta)
|
||||
| .iss = $app_id
|
||||
' <<< "{}" | tr -d '\n'
|
||||
}
|
||||
|
||||
base64url() {
|
||||
base64 | tr '+/' '-_' | tr -d '=\n'
|
||||
}
|
||||
|
||||
rs256_sign() {
|
||||
openssl dgst -binary -sha256 -sign <(echo "$1")
|
||||
}
|
||||
|
||||
request_access_token() {
|
||||
jwt_payload=$(build_jwt_payload)
|
||||
encoded_jwt_parts=$(base64url <<<"${JWT_JOSE_HEADER}").$(base64url <<<"${jwt_payload}")
|
||||
encoded_mac=$(echo -n "${encoded_jwt_parts}" | rs256_sign "${APP_PRIVATE_KEY}" | base64url)
|
||||
generated_jwt="${encoded_jwt_parts}.${encoded_mac}"
|
||||
|
||||
auth_header="Authorization: Bearer ${generated_jwt}"
|
||||
|
||||
app_installations_response=$(curl -sX GET \
|
||||
-H "${auth_header}" \
|
||||
-H "${API_HEADER}" \
|
||||
"${APP_INSTALLATIONS_URI}" \
|
||||
)
|
||||
access_token_url=$(echo "${app_installations_response}" | jq --raw-output '.[] | select (.account.login == "'"${APP_LOGIN}"'" and .app_id == '"${APP_ID}"') .access_tokens_url')
|
||||
curl -sX POST \
|
||||
-H "${CONTENT_LENGTH_HEADER}" \
|
||||
-H "${auth_header}" \
|
||||
-H "${API_HEADER}" \
|
||||
"${access_token_url}" | \
|
||||
jq --raw-output .token
|
||||
}
|
||||
|
||||
request_access_token
|
||||
+56
-12
@@ -1,12 +1,15 @@
|
||||
#!/usr/bin/dumb-init /bin/bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
export RUNNER_ALLOW_RUNASROOT=1
|
||||
export PATH=$PATH:/actions-runner
|
||||
export PATH=${PATH}:/actions-runner
|
||||
|
||||
# Un-export these, so that they must be passed explicitly to the environment of
|
||||
# any command that needs them. This may help prevent leaks.
|
||||
export -n ACCESS_TOKEN
|
||||
export -n RUNNER_TOKEN
|
||||
export -n APP_ID
|
||||
export -n APP_PRIVATE_KEY
|
||||
|
||||
deregister_runner() {
|
||||
echo "Caught SIGTERM. Deregistering runner"
|
||||
@@ -25,9 +28,10 @@ _RUNNER_WORKDIR=${RUNNER_WORKDIR:-/_work}
|
||||
_LABELS=${LABELS:-default}
|
||||
_RUNNER_GROUP=${RUNNER_GROUP:-Default}
|
||||
_GITHUB_HOST=${GITHUB_HOST:="github.com"}
|
||||
_RUN_AS_ROOT=${RUN_AS_ROOT:="true"}
|
||||
|
||||
# ensure backwards compatibility
|
||||
if [[ -z $RUNNER_SCOPE ]]; then
|
||||
if [[ -z ${RUNNER_SCOPE} ]]; then
|
||||
if [[ ${ORG_RUNNER} == "true" ]]; then
|
||||
echo 'ORG_RUNNER is now deprecated. Please use RUNNER_SCOPE="org" instead.'
|
||||
export RUNNER_SCOPE="org"
|
||||
@@ -43,6 +47,9 @@ case ${RUNNER_SCOPE} in
|
||||
[[ -z ${ORG_NAME} ]] && ( echo "ORG_NAME required for org runners"; exit 1 )
|
||||
_SHORT_URL="https://${_GITHUB_HOST}/${ORG_NAME}"
|
||||
RUNNER_SCOPE="org"
|
||||
if [[ -n "${APP_ID}" ]] && [[ -z "${APP_LOGIN}" ]]; then
|
||||
APP_LOGIN=${ORG_NAME}
|
||||
fi
|
||||
;;
|
||||
|
||||
ent*)
|
||||
@@ -55,28 +62,44 @@ case ${RUNNER_SCOPE} in
|
||||
[[ -z ${REPO_URL} ]] && ( echo "REPO_URL required for repo runners"; exit 1 )
|
||||
_SHORT_URL=${REPO_URL}
|
||||
RUNNER_SCOPE="repo"
|
||||
if [[ -n "${APP_ID}" ]] && [[ -z "${APP_LOGIN}" ]]; then
|
||||
APP_LOGIN=${REPO_URL%/*}
|
||||
APP_LOGIN=${APP_LOGIN##*/}
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
configure_runner() {
|
||||
ARGS=()
|
||||
if [[ -n "${APP_ID}" ]] && [[ -n "${APP_PRIVATE_KEY}" ]] && [[ -n "${APP_LOGIN}" ]]; then
|
||||
if [[ -n "${ACCESS_TOKEN}" ]] || [[ -n "${RUNNER_TOKEN}" ]]; then
|
||||
echo "ERROR: ACCESS_TOKEN or RUNNER_TOKEN provided but are mutually exclusive with APP_ID, APP_PRIVATE_KEY and APP_LOGIN." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Obtaining access token for app_id ${APP_ID} and login ${APP_LOGIN}"
|
||||
nl="
|
||||
"
|
||||
ACCESS_TOKEN=$(APP_ID="${APP_ID}" APP_PRIVATE_KEY="${APP_PRIVATE_KEY//\\n/${nl}}" APP_LOGIN="${APP_LOGIN}" bash /app_token.sh)
|
||||
elif [[ -n "${APP_ID}" ]] || [[ -n "${APP_PRIVATE_KEY}" ]] || [[ -n "${APP_LOGIN}" ]]; then
|
||||
echo "ERROR: All of APP_ID, APP_PRIVATE_KEY and APP_LOGIN must be specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "${ACCESS_TOKEN}" ]]; then
|
||||
echo "Obtaining the token of the runner"
|
||||
_TOKEN=$(ACCESS_TOKEN="${ACCESS_TOKEN}" bash /token.sh)
|
||||
RUNNER_TOKEN=$(echo "${_TOKEN}" | jq -r .token)
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
if [ -n "${EPHEMERAL}" ]; then
|
||||
echo "Ephemeral option is enabled"
|
||||
_EPHEMERAL="--ephemeral"
|
||||
else
|
||||
_EPHEMERAL=""
|
||||
ARGS+=("--ephemeral")
|
||||
fi
|
||||
|
||||
if [ -n "${DISABLE_AUTO_UPDATE}" ]; then
|
||||
echo "Disable auto update option is enabled"
|
||||
_AUTO_UPDATE="--disableupdate"
|
||||
else
|
||||
_AUTO_UPDATE=""
|
||||
ARGS+=("--disableupdate")
|
||||
fi
|
||||
|
||||
echo "Configuring"
|
||||
@@ -89,8 +112,10 @@ configure_runner() {
|
||||
--runnergroup "${_RUNNER_GROUP}" \
|
||||
--unattended \
|
||||
--replace \
|
||||
${_EPHEMERAL} \
|
||||
${_AUTO_UPDATE}
|
||||
"${ARGS[@]}"
|
||||
|
||||
[[ ! -d "${_RUNNER_WORKDIR}" ]] && mkdir "${_RUNNER_WORKDIR}"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -124,5 +149,24 @@ if [[ ${_DISABLE_AUTOMATIC_DEREGISTRATION} == "false" ]]; then
|
||||
trap deregister_runner SIGINT SIGQUIT SIGTERM INT TERM QUIT
|
||||
fi
|
||||
|
||||
# Container's command (CMD) execution
|
||||
"$@"
|
||||
# Container's command (CMD) execution as runner user
|
||||
|
||||
|
||||
if [[ ${_RUN_AS_ROOT} == "true" ]]; then
|
||||
if [[ $(id -u) -eq 0 ]]; then
|
||||
"$@"
|
||||
else
|
||||
echo "ERROR: RUN_AS_ROOT env var is set to true but the user has been overridden and is not running as root, but UID '$(id -u)'"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ $(id -u) -eq 0 ]]; then
|
||||
[[ -n "${CONFIGURED_ACTIONS_RUNNER_FILES_DIR}" ]] && /usr/bin/chown -R runner "${CONFIGURED_ACTIONS_RUNNER_FILES_DIR}"
|
||||
/usr/bin/chown -R runner "${_RUNNER_WORKDIR}" /actions-runner
|
||||
# The toolcache is not recursively chowned to avoid recursing over prepulated tooling in derived docker images
|
||||
/usr/bin/chown runner /opt/hostedtoolcache/
|
||||
/usr/sbin/gosu runner "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user