I’m a big fan of GitHub Actions to automate workflows. They are declarative in nature, developed as open-source components, and execution is container-based. I also recently learned that GitHub Actions were actually not tied to GitHub infrastructure, and can be executed locally, using act.
Let’s build OpenSearch job-scheduler on a local Linux.
Download and install act from here. I just run the
install.sh because YOLO.
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
Check Out JobScheduler
git checkout email@example.com:opensearch-project/job-scheduler.git cd job-scheduler
Modify Workflow (Temporary)
By default the
runner user under which the workflow runs in the Docker container does not have write access to the current folder, therefore the workflow as implemented requires one additional step. Add the following code locally in
.github/workflows/test-and-build-workflow.yml after “Setup Java”.
- name: Chown run: | sudo chown -R runner .
The current workflow implementation checks out OpenSearch and builds it, thus needing a token to
git clone from GitHub. Create a
.secrets file with a read-only GitHub token. This gets automatically picked up by act.
act -r pull_request -P ubuntu-latest=catthehacker/ubuntu:runner-latest
Act uses an open-source Docker container to run the job. Enjoy a
BUILD SUCCESSFUL result!