Skip to content

Commit

Permalink
Fix title of docker image for ci
Browse files Browse the repository at this point in the history
Merge in CI/github-actions-runner from fix/docker_image_2 to master

* commit '7edc5cc6412d54d013abe738a158ef7adf3693f4':
  improve documentation
  update description
  add better comment
  use multiline bash commands
  rename docker image
  • Loading branch information
maximtop committed Apr 27, 2024
2 parents 4cb0530 + 7edc5cc commit adb87a1
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: no-entrypoint.Dockerfile
file: ci.Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}-no-entrypoint
tags: ${{ steps.meta.outputs.tags }}-ci
labels: ${{ steps.meta.outputs.labels }}
build-args: "VERSION=${GITHUB_REF##*/}"
70 changes: 57 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
# @adguard/github-actions-runner

## Description
`@adguard/github-actions-runner` is a versatile command-line interface (CLI) tool designed to facilitate the automation of GitHub Actions, particularly geared towards simplifying repository mirroring, command execution, and artifact management in a seamless manner. It leverages GitHub's robust API to offer a streamlined approach to running and managing GitHub workflows, making it an essential tool for developers looking to integrate GitHub Actions more deeply into their development and deployment processes.

Imagine that you have a CI pipeline, and you want to run a part of your tasks on GitHub
Actions.

`@adguard/github-actions-runner` is a versatile command-line interface (CLI) tool designed to facilitate the
automation of GitHub Actions. It is particularly geared towards simplifying repository mirroring, command execution, and
artifact management. By leveraging GitHub's robust API, it provides a streamlined approach to running and managing
GitHub workflows, making it an essential tool for developers who need to integrate GitHub Actions more deeply into their
development and deployment processes.

Whether you're a DevOps engineer or a software developer, this tool allows you to interact with GitHub Actions in a way
that enhances productivity and offers greater flexibility. The CLI is designed with various use cases in mind, from
automating workflows to managing artifacts, enabling developers to focus more on writing code and less on managing
pipelines.

## Installation
To get started with using `@adguard/github-actions-runner`, ensure that Node.js is installed on your system, and then you can install the package via:

pnpm:
To get started with using `@adguard/github-actions-runner`, ensure that Node.js is installed on your system, then
install the package with one of the following methods:

- Using pnpm:
```bash
pnpm install @adguard/github-actions-runner
```

npm:
- Using npm:
```bash
npm install @adguard/github-actions-runner
```

or yarn:
- Using yarn:
```bash
yarn add @adguard/github-actions-runner
```

## Usage
The CLI tool can be used to trigger and manage GitHub Actions with the following command format:

The CLI tool can trigger and manage GitHub Actions with the following command format:

```bash
Usage: github-actions-runner run-action [options]
Expand All @@ -44,12 +60,14 @@ Options:
```
### Note:
Ensure that you have a valid `GITHUB_TOKEN` set in your environment variables for authentication.
### Example:
To run a GitHub Action workflow with the specified configuration:
```
```bash
github-actions-runner run-action \
--repo "AdguardTeam/GithubActionsRunner" \
--workflow "build.yml" \
Expand All @@ -61,18 +79,24 @@ github-actions-runner run-action \
--verbose
```
### Docker:
This CLI tool is also available as a Docker image, which can be used to run the tool in a containerized environment.
The Docker image can be pulled from the GitHub Container Registry:
### Docker
This CLI tool is available as a Docker image, enabling its use in containerized environments. There are two Docker
images available, each serving different use cases.
#### Standard Docker Image
The standard Docker image includes an `ENTRYPOINT` to simplify command execution. You can pull it from the GitHub
Container Registry and run it like this:
```bash
docker pull ghcr.io/adguard/github-actions-runner:latest
```
To run the Docker image, you can use the following command:
To run the image, use the following command:
```bash
docker run --rm -it ghcr.io/adguardteam/githubactionsrunner:latest run-action \
docker run --rm -it ghcr.io/adguard/github-actions-runner:latest run-action \
--repo "AdguardTeam/GithubActionsRunner" \
--workflow "build.yml" \
--branch "master" \
Expand All @@ -83,5 +107,25 @@ docker run --rm -it ghcr.io/adguardteam/githubactionsrunner:latest run-action \
--verbose
```
#### Docker Image without ENTRYPOINT
This alternative Docker image doesn't set an `ENTRYPOINT`, providing more flexibility for advanced use cases. Pull it
from the GitHub Container Registry and run it like this:
```bash
docker pull ghcr.io/adguard/github-actions-runner:latest-ci
```
To run the image, you need to specify the command manually:
```bash
docker run --rm -it ghcr.io/adguard/github-actions-runner:latest-ci /bin/sh
```
In this mode, you can execute commands manually inside the container or create custom entry points for specific
workflows.
## Contributing
Contributions to extend the functionality or improve the tool are welcome. Please refer to the project's repository on GitHub to submit issues or pull requests.
Contributions to extend the functionality or improve the tool are welcome. Please refer to the project's repository on
GitHub to submit issues or pull requests.
11 changes: 8 additions & 3 deletions bamboo-specs/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Build:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
Expand All @@ -46,7 +46,12 @@ Build:
branch="${bamboo_planRepository_branchName}"
revision="${bamboo_planRepository_revision}"
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow build.yml --artifacts-path .
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action \
--repo AdguardTeam/GithubActionsRunner \
--branch "$branch" \
--rev "$revision" \
--workflow build.yml \
--artifacts-path .
- inject-variables:
file: build.txt
scope: RESULT
Expand All @@ -64,7 +69,7 @@ Build:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npmjs:
set -e
set -x
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
Expand Down
26 changes: 8 additions & 18 deletions bamboo-specs/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plan:
key: GHACTIONSRUNEXAMPLE
name: github-actions-runner - example
variables:
# TODO replace to :latest-ci
dockerNode: ghcr.io/adguardteam/githubactionsrunner:latest-no-entrypoint

stages:
Expand Down Expand Up @@ -32,31 +33,20 @@ Test:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
branch="${bamboo_planRepository_branchName}"
revision="${bamboo_planRepository_revision}"
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} github-actions-runner run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow example.yml --artifacts-path .
final-tasks:
- script:
interpreter: SHELL
scripts:
- |-
set -x
set -e
# Fix mixed logs
exec 2>&1
ls -laht
echo "Size before cleanup:" && du -h | tail -n 1
rm -rf node_modules
echo "Size after cleanup:" && du -h | tail -n 1
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} github-actions-runner run-action \
--repo AdguardTeam/GithubActionsRunner \
--branch "$branch" \
--rev "$revision" \
--workflow example.yml \
--artifacts-path .
artifacts:
- name: github-actions-runner.tgz
pattern: github-actions-runner.tgz
Expand Down
2 changes: 1 addition & 1 deletion bamboo-specs/increment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Increment:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -alt
Expand Down
10 changes: 7 additions & 3 deletions bamboo-specs/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Test:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
Expand All @@ -46,7 +46,11 @@ Test:
branch="${bamboo_planRepository_branchName}"
revision="${bamboo_planRepository_revision}"
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action --repo AdguardTeam/GithubActionsRunner --branch "$branch" --rev "$revision" --workflow test.yml
GITHUB_TOKEN=${bamboo.githubActionsRunnerPassword} node dist/bin/index.js run-action \
--repo AdguardTeam/GithubActionsRunner \
--branch "$branch" \
--rev "$revision" \
--workflow test.yml
final-tasks:
- script:
interpreter: SHELL
Expand All @@ -55,7 +59,7 @@ Test:
set -x
set -e
# Fix mixed logs
# Combine stderr and stdout for consistent log output
exec 2>&1
ls -laht
Expand Down
4 changes: 4 additions & 0 deletions no-entrypoint.Dockerfile → ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# This Dockerfile is used to build the GitHub Actions Runner image used in the CI pipeline.
# It doesn't has the ENTRYPOINT instruction, so it can't be used to run the image as a container.
# The ENTRYPOINT instruction is added in the Dockerfile in the root of the project.

# Stage 1: Build environment
FROM node:20.12.2-bookworm-slim AS builder

Expand Down

0 comments on commit adb87a1

Please sign in to comment.