diff --git a/README.md b/README.md index f57f792..1eed814 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ github_runner_non_java_image | the non-java/android runner image github_runner_env_file | whether to use an env file for passing extra environment variables into the runner container (defaults to false) github_runner_env_filename | the filename of the env file for passing extra environment variables into the container (defaults to ".env") github_runner_github_host | The GITHUB_HOST used for registering the runner (defaults to "github.com") +github_runner_persist_config | whether to persist runner configuration across container restarts using a named volume (defaults to true) Notes: the env file lets you do things like set site-specific credentials into the runner that can be built into the code at build time, for instance, Wi-Fi credentials that can be built into tests that are specific to the location of diff --git a/galaxy.yml b/galaxy.yml index 938a4bd..d4d2f97 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -8,7 +8,7 @@ description: "Installs github self hosted repo or org runners within a docker co can be a vanilla runner, or one with java / android installed." license_file: LICENSE readme: README.md -version: 0.1.0 +version: 0.1.1 repository: https://github.com/compscidr/ansible-github-runner tags: - github diff --git a/roles/github_runner/defaults/main.yml b/roles/github_runner/defaults/main.yml index 3cca97b..68919f5 100644 --- a/roles/github_runner/defaults/main.yml +++ b/roles/github_runner/defaults/main.yml @@ -20,3 +20,5 @@ github_runner_env_filename: ".env" github_runner_adb_port: 5037 github_runner_github_host: "github.com" + +github_runner_persist_config: true diff --git a/roles/github_runner/tasks/main.yml b/roles/github_runner/tasks/main.yml index f59915b..77be663 100644 --- a/roles/github_runner/tasks/main.yml +++ b/roles/github_runner/tasks/main.yml @@ -17,7 +17,8 @@ runner_volumes: >- {{ ['/var/run/docker.sock:/var/run/docker.sock'] + - (['/root/.android:/root/.android'] if github_runner_android else []) + (['/root/.android:/root/.android'] if github_runner_android else []) + + ([github_runner_name ~ '-runner-data:/runner-data'] if github_runner_persist_config else []) }} runner_env: >- {{ @@ -34,5 +35,8 @@ ) | combine( {'RUNNER_SCOPE': 'org', 'ORG_NAME': github_runner_org_name} if github_runner_org else {} + ) | combine( + {'CONFIGURED_ACTIONS_RUNNER_FILES_DIR': '/runner-data'} + if github_runner_persist_config else {} ) }}