Compare commits

..
31 Commits
Author SHA1 Message Date
Marcus Young 48ee0c82d4 Bump to version 2.263.0 2020-05-21 15:43:07 -05:00
Marcus Young a3b5dc873d Add automatic release creation 2020-05-13 13:55:09 -05:00
myoung34andGitHub 632d9e59ad bump to 2.262.1 2020-05-12 15:32:17 -05:00
Marcus Young 3ef0c00503 Remove unneeded curl echo in entrypoint 2020-05-11 14:48:22 -05:00
Marcus Young 47144a0075 Bump to 2.262.0 2020-05-11 14:46:02 -05:00
Marcus Young 5080efc02c Test runsvc vs run.sh 2020-05-11 14:40:44 -05:00
myoung34andGitHub de737c2bff Merge pull request #20 from pirate/patch-2
Add docker-compose example setup
2020-04-28 06:49:34 -05:00
Nick SweetingandGitHub d3302f81d6 Add docker-compose example setup 2020-04-28 04:57:15 -04:00
myoung34andGitHub 94765718f8 Merge pull request #18 from EduMelo/master
Fixed REPO_URL setting without ACCESS_TOKEN
2020-04-27 06:18:06 -05:00
EduMelo 35e638434c Remove redundant line 2020-04-27 01:47:58 +00:00
EduMelo d0dfd51b8f Fixed REPO_URL setting without ACCESS_TOKEN 2020-04-26 23:02:35 +00:00
myoung34andGitHub 6bb8d76ea2 Merge pull request #17 from mvcaaa/patch-1
Update entrypoint.sh
2020-04-25 15:38:49 -05:00
Andrey AstashovandGitHub d18d41c831 Update entrypoint.sh
- Better formatting
- Added `--unattended` flag
2020-04-25 22:44:19 +03:00
myoung34andGitHub 449d82760a Update README.md 2020-04-25 08:02:00 -05:00
myoung34andGitHub f47c515abd Create FUNDING.yml 2020-04-25 08:00:07 -05:00
Marcus Young 5893376f9d Fix single quote in stage 2020-04-25 07:52:51 -05:00
Marcus Young a5497419bc Let ORG be inferred in base, fix escaping 2020-04-25 07:28:06 -05:00
Marcus Young a1590538ff update maintainer email in dockerfile 2020-04-25 07:23:48 -05:00
Marcus Young b6d79c9dfb Set base latest to eoan 2020-04-25 05:57:45 -05:00
myoung34andGitHub a794698340 Merge pull request #16 from pirate/patch-1
Fix inifinite loop on startup if runner was stopped and restarted
2020-04-25 05:34:16 -05:00
Marcus Young afec008f29 Fix old base to previously working non-base steps 2020-04-25 05:29:39 -05:00
Nick SweetingandGitHub c7e53fe739 fix tzdata requesting user input on build 2020-04-25 03:30:32 -04:00
Nick SweetingandGitHub 4ddf3ecf7b Fix inifinite loop on startup if runner was stopped and restarted 2020-04-25 03:15:07 -04:00
Marcus Young 499ec5be2b Fix maintainer to match github email 2020-04-24 22:10:32 -05:00
Marcus Young bf3b69b42c Fix cp in base xenial 2020-04-24 22:08:49 -05:00
Marcus Young 3d71db0489 Bump git to 2.26.2 to test pipelines 2020-04-24 22:04:39 -05:00
Marcus Young d94e9ac8ed Fix bad cp in new base 2020-04-24 21:23:43 -05:00
Marcus Young 4ad9ab74d2 Remove uneeded args from base 2020-04-24 21:21:18 -05:00
Marcus Young e1c417920c [wip] Split Docker container into 2 parts to make builds much faster 2020-04-24 21:18:52 -05:00
Marcus Young 9e91608d19 Add support for org runners with ORG_RUNNER=true,ORG_NAME=wut,LABELS=a,b env vars 2020-04-24 18:39:31 -05:00
Marcus Young 6b6ee9e9f3 Bump to 2.169.1 2020-04-15 14:21:27 -05:00
8 changed files with 225 additions and 52 deletions
+3
View File
@@ -0,0 +1,3 @@
# These are supported funding model platforms
github: myoung34
+68
View File
@@ -0,0 +1,68 @@
name: GitHub Actions Runner in Docker - Base
on:
push:
paths:
- Dockerfile.base
branches:
- master
- develop
jobs:
ubuntu_base_latest_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.base -t ${ORG}/github-runner-base:latest --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_base_bionic_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.base.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.base.ubuntu-bionic -t ${ORG}/github-runner-base:ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_base_xenial_deploy:
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@master
- name: Get GitHub organization or user
run: echo ::set-env name=ORG::$(dirname ${GITHUB_REPOSITORY})
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile.base Dockerfile.base.ubuntu-xenial; sed -i.bak 's/FROM.*/FROM ubuntu:xenial/' Dockerfile.base.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.base.ubuntu-xenial -t ${ORG}/github-runner-base:ubuntu-xenial --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
+3 -2
View File
@@ -2,6 +2,7 @@ name: GitHub Actions Runner in Docker - Latest
on:
push:
paths-ignore:
- Dockerfile.base
- README.md
branches:
- master
@@ -41,7 +42,7 @@ jobs:
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.ubuntu-bionic
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
@@ -61,7 +62,7 @@ jobs:
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak 's/FROM.*/FROM ubuntu:xenial/' Dockerfile.ubuntu-xenial
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
+21 -4
View File
@@ -1,14 +1,29 @@
name: GitHub Actions Runner in Docker - Release
on:
push:
paths-ignore:
- README.md
tags:
- '*'
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
ubuntu_latest_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
uses: actions/checkout@master
@@ -29,6 +44,7 @@ jobs:
run: docker buildx build -f Dockerfile -t ${ORG}/github-runner:${TAG} --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_bionic_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
uses: actions/checkout@master
@@ -44,13 +60,14 @@ jobs:
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak 's/FROM.*/FROM ubuntu:bionic/' Dockerfile.ubuntu-bionic
run: cp Dockerfile Dockerfile.ubuntu-bionic; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-bionic/" Dockerfile.ubuntu-bionic
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -f Dockerfile.ubuntu-bionic -t ${ORG}/github-runner:${TAG}-ubuntu-bionic --output "type=image,push=true" --platform linux/amd64,linux/arm/v7,linux/arm64 .
ubuntu_xenial_tag:
runs-on: ubuntu-latest
needs: create-release
steps:
- name: Copy Repo Files
uses: actions/checkout@master
@@ -66,7 +83,7 @@ jobs:
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Copy Dockerfile
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak 's/FROM.*/FROM ubuntu:xenial/' Dockerfile.ubuntu-xenial
run: cp Dockerfile Dockerfile.ubuntu-xenial; sed -i.bak "s/FROM.*/FROM ${ORG}\/github-runner-base:ubuntu-xenial/" Dockerfile.ubuntu-xenial
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
+4 -41
View File
@@ -1,48 +1,11 @@
FROM ubuntu:rolling
LABEL maintainer="3vilpenguin@gmail.com"
# hadolint ignore=DL3007
FROM myoung34/github-runner-base:latest
LABEL maintainer="myoung34@my.apsu.edu"
ARG GIT_VERSION="2.23.0"
ARG GH_RUNNER_VERSION="2.169.0"
ARG GH_RUNNER_VERSION="2.263.0"
ARG TARGETPLATFORM
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3003
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
tar \
apt-transport-https \
ca-certificates \
sudo \
gnupg-agent \
software-properties-common \
build-essential \
zlib1g-dev \
gettext \
liblttng-ust0 \
libcurl4-openssl-dev \
inetutils-ping \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& c_rehash \
&& cd /tmp \
&& curl -sL https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz -o git.tgz \
&& tar zxf git.tgz \
&& cd git-${GIT_VERSION} \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& cd / \
&& rm -rf /tmp/git.tgz /tmp/git-${GIT_VERSION}
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& [[ $(lsb_release -cs) == "eoan" ]] && ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu disco stable" ) || ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" )\
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sL "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
WORKDIR /actions-runner
COPY install_actions.sh /actions-runner
+44
View File
@@ -0,0 +1,44 @@
FROM ubuntu:eoan
LABEL maintainer="myoung34@my.apsu.edu"
ARG GIT_VERSION="2.26.2"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
# hadolint ignore=DL3003
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
tar \
apt-transport-https \
ca-certificates \
sudo \
gnupg-agent \
software-properties-common \
build-essential \
zlib1g-dev \
gettext \
liblttng-ust0 \
libcurl4-openssl-dev \
inetutils-ping \
jq \
&& rm -rf /var/lib/apt/lists/* \
&& c_rehash \
&& cd /tmp \
&& curl -sL https://www.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz -o git.tgz \
&& tar zxf git.tgz \
&& cd git-${GIT_VERSION} \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& cd / \
&& rm -rf /tmp/git.tgz /tmp/git-${GIT_VERSION}
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
&& [[ $(lsb_release -cs) == "eoan" ]] && ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu disco stable" ) || ( add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" )\
&& apt-get update \
&& apt-get install -y docker-ce docker-ce-cli containerd.io --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN curl -sL "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose
+57
View File
@@ -1,6 +1,8 @@
Docker Github Actions Runner
============================
[![Docker Pulls](https://img.shields.io/docker/pulls/myoung34/github-runner.svg)](https://hub.docker.com/r/myoung34/github-runner)
This will run the [new self-hosted github actions runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/hosting-your-own-runners).
This has been tested and verified on:
@@ -21,6 +23,19 @@ If you're using a RHEL based OS with SELinux, add `--security-opt=label=disable`
### Manual ###
```
# org runner
docker run -d --restart always --name github-runner \
-e REPO_URL="https://github.com/myoung34/repo" \
-e RUNNER_NAME="foo-runner" \
-e RUNNER_TOKEN="footoken" \
-e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \
-e ORG_RUNNER="true" \
-e ORG_NAME="octokode" \
-e LABELS="my-label,other-label" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \
myoung34/github-runner:latest
# per repo
docker run -d --restart always --name github-runner \
-e REPO_URL="https://github.com/myoung34/repo" \
-e RUNNER_NAME="foo-runner" \
@@ -45,6 +60,9 @@ function github-runner {
-e RUNNER_TOKEN="$2" \
-e RUNNER_NAME="linux-${repo}" \
-e RUNNER_WORKDIR="/tmp/github-runner-${repo}" \
-e ORG_RUNNER="true" \
-e ORG_NAME="octokode" \
-e LABELS="my-label,other-label" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/github-runner-${repo}:/tmp/github-runner-${repo} \
--name $name ${org}/github-runner:${tag}
@@ -54,6 +72,33 @@ github-runner your-account/your-repo AARGHTHISISYOURGHACTIONSTOKEN
github-runner your-account/some-other-repo ARGHANOTHERGITHUBACTIONSTOKEN ubuntu-xenial
```
Or `docker-compose.yml`:
```yml
version: '2.3'
services:
worker:
build: .
image: myoung34/github-runner:latest
environment:
REPO_URL: https://github.com/example/repo
RUNNER_NAME: example-name
RUNNER_TOKEN: someGithubTokenHere
RUNNER_WORKDIR: /tmp/runner/work
ORG_RUNNER: true
ORG_NAME: example-github-org
LABELS: linux,x64,gpu
security_opt:
# needed on SELinux systems to allow docker container to manage other docker containers
- label:disable
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- '/tmp/runner:/tmp/runner'
# note: a quirk of docker-in-docker is that this path
# needs to be the same path on host and inside the container,
# docker mgmt cmds run outside of docker but expect the paths from within
```
### Nomad ###
```
@@ -68,6 +113,9 @@ job "github_runner" {
REPO_URL = "https://github.com/your-account/your-repo"
RUNNER_TOKEN = "footoken"
RUNNER_WORKDIR = "/tmp/github-runner-your-repo"
ORG_RUNNER = "true"
ORG_NAME = "octokode"
LABELS = "my-label,other-label"
}
config {
@@ -111,6 +159,12 @@ spec:
- name: runner
image: myoung34/github-runner:latest
env:
- name: ORG_RUNNER
value: true
- name: ORG_NAME
value: octokode
- name: LABELS
value: my-label,other-label
- name: RUNNER_TOKEN
value: footoken
- name: REPO_URL
@@ -156,6 +210,9 @@ docker run -d --restart always --name github-runner \
-e REPO_URL="https://github.com/myoung34/repo" \
-e RUNNER_NAME="foo-runner" \
-e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \
-e ORG_RUNNER="true" \
-e ORG_NAME="octokode" \
-e LABELS="my-label,other-label" \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \
myoung34/github-runner:latest
+25 -5
View File
@@ -5,6 +5,9 @@ export PATH=$PATH:/actions-runner
_RUNNER_NAME=${RUNNER_NAME:-default}
_RUNNER_WORKDIR=${RUNNER_WORKDIR:-/_work}
_ORG_RUNNER=${ORG_RUNNER:-false}
_LABELS=${LABELS:-default}
_SHORT_URL=${REPO_URL}
if [[ -n "${ACCESS_TOKEN}" ]]; then
URI=https://api.github.com
@@ -13,17 +16,34 @@ if [[ -n "${ACCESS_TOKEN}" ]]; then
AUTH_HEADER="Authorization: token ${ACCESS_TOKEN}"
_PROTO="$(echo "${REPO_URL}" | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# shellcheck disable=SC2116
_URL="$(echo "${REPO_URL/${_PROTO}/}")"
_PATH="$(echo "${_URL}" | grep / | cut -d/ -f2-)"
_ACCOUNT="$(echo "${_PATH}" | cut -d/ -f1)"
_REPO="$(echo "${_PATH}" | cut -d/ -f2)"
_FULL_URI="${URI}/repos/${_ACCOUNT}/${_REPO}/actions/runners/registration-token"
if [[ ${_ORG_RUNNER} == "true" ]]; then
[[ -z ${ORG_NAME} ]] && ( echo "ORG_NAME required for org runners"; exit 1 )
_FULL_URI="${URI}/orgs/${ORG_NAME}/actions/runners/registration-token"
_SHORT_URL="${_PROTO}github.com/${ORG_NAME}"
fi
RUNNER_TOKEN="$(curl -XPOST -fsSL \
-H "${AUTH_HEADER}" \
-H "${API_HEADER}" \
"${URI}/repos/${_ACCOUNT}/${_REPO}/actions/runners/registration-token" \
-H "${AUTH_HEADER}" \
-H "${API_HEADER}" \
"${_FULL_URI}" \
| jq -r '.token')"
fi
./config.sh --url "${REPO_URL}" --token "${RUNNER_TOKEN}" --name "${_RUNNER_NAME}" --work "${_RUNNER_WORKDIR}"
./run.sh
echo "Configuring"
./config.sh \
--url "${_SHORT_URL}" \
--token "${RUNNER_TOKEN}" \
--name "${_RUNNER_NAME}" \
--work "${_RUNNER_WORKDIR}" \
--labels "${_LABELS}" \
--unattended \
--replace
./bin/runsvc.sh