You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I'm using the non-ephemeral runners, which is fine with me for performance/isolation tradeoff.
However, it looks like the working directory given to workflows does not get cleared between jobs. This can lead to surprise for developers who expect a clean working directory.
Is there an option available to have the runners clear the working directory between runs?
Here's a short workflow I'm using to test this case:
name: Ephemerality Teston:
workflow_dispatch:
jobs:
write:
runs-on: [self-hosted]name: Writesteps:
- name: Write filesrun: | echo Current Directory: $(pwd) ls echo "Local File Exists" > hello.txt echo "Temp File Exists" > /tmp/hello.txtread:
runs-on: [self-hosted]needs: [write]name: Readsteps:
- name: Test for persisted filesrun: | echo Current Directory: $(pwd) ls cat hello.txt || echo "Local dir cleared" cat /tmp/hello.txt || echo "Tmp dir cleared" if [ -f hello.txt ]; then echo "Local file was not cleared!" exit 1 fi if [ -f /tmp/hello.txt ]; then echo "Temp file was not cleared!" exit 1 fi
Outputs:
// Write
Current Directory: /opt/actions-runner/_work/gh-self-hosted-runners/gh-self-hosted-runners
hello.txt
// Read
Current Directory: /opt/actions-runner/_work/gh-self-hosted-runners/gh-self-hosted-runners
hello.txt
Local File Exists
Temp File Exists
Local file was not cleared!
The text was updated successfully, but these errors were encountered:
From their blog post, github seems to recommend using pre/post job hooks for cleanup. Currently the terraform does not allow the user to override or extend the pre job hook created by the terraform.
The pre job script is overridden and not appended to.
The script does not execute any additional user configurable scripts.
The start-runner.sh is executed after both pre and post user-data scripts which the user can provide as inputs to the terraform.
All these make it really difficult to extend the pre job hook.
@npalm Can we add a feature where the user can extend or replace the pre job script?
Hi there, I'm using the non-ephemeral runners, which is fine with me for performance/isolation tradeoff.
However, it looks like the working directory given to workflows does not get cleared between jobs. This can lead to surprise for developers who expect a clean working directory.
Is there an option available to have the runners clear the working directory between runs?
Here's a short workflow I'm using to test this case:
Outputs:
The text was updated successfully, but these errors were encountered: