Skip to content

Commit

Permalink
Add gh command
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasCote committed Mar 13, 2024
1 parent 7a8e5fc commit 4fbb902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ENV TOKEN=${TOKEN} \
REPO=${REPO}

# Install jq and git
RUN dnf -y update; yum -y install jq git python python-pip
RUN dnf -y update; yum -y install jq git python python-pip && \
dnf -y install 'dnf-command(config-manager)' && \
dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo && \
dnf -y install gh

RUN cd /home/podman && mkdir actions-runner && cd actions-runner && \
curl -O -L https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz && \
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
Create a GitHub runner container image that builds containers with rootless podman

```{note}
A GitHub API token is required to connect the runner to a repository. GitHub tokens can be generated at this [link to creating API tokens](https://github.com/settings/tokens)
A GitHub API token is required to connect the runner to a repository. GitHub tokens can be generated at this [![link to creating API tokens](https://github.com/settings/tokens)]
```

[![GitHub Runner Build, Push, & Update](https://github.com/NicholasCote/github-runner/actions/workflows/gh-runner-build.yaml/badge.svg)](https://github.com/NicholasCote/github-runner/actions/workflows/gh-runner-build.yaml)

## GitOps CICD

This repository utilizes GitHub actions to build a new container image whenever changes are made, push that image to NSF NCAR's Harbor container registry,
This repository utilizes GitHub actions to build a new container image whenever changes are made, push that image to NSF NCAR's Harbor container registry, and update the Helm chart values.yaml file to use the new image tag. This repository is connected to the NSF NCAR instance of Argo CD and will automatically sync to use the new image.

## Building an image

The container image needs to know the repository to use and uses an API token to connect to it in order to get a GitHub runner registration token. These can be supplied during the container build, or when the container is run. Examples of both commands can be found below:

***Note:*** Do not include secret information on build if you are planning on storing the container image in a public repository. Instead build the base container and specify the secret information when running the container.

`podman build -t hub.k8s.ucar.edu/ncote/github-runner:2024-03-06.18.22 .`
`podman build -t hub.k8s.ucar.edu/ncote/github-runner:2024-03-06.21.38 .`

```
podman run -e REPO=NicholasCote/github-runner -e TOKEN=${GITHUB_TOKEN} hub.k8s.ucar.edu/ncote/github-runner:2024-03-06.18.22
podman run -e REPO=NicholasCote/github-runner -e TOKEN=${GITHUB_TOKEN} hub.k8s.ucar.edu/ncote/github-runner:2024-03-06.21.38
```

## Using K8s Secrets
Expand Down

0 comments on commit 4fbb902

Please sign in to comment.