Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add STARTUP_DELAY to entrypoint.sh #592

Merged
merged 4 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,61 @@ Your base64'ed PAT token has a new line at the end, it needs to be created witho
* `echo -n $TOKEN | base64`
* Create the secret as described in the docs using the shell and documeneted flags

#### Runner coming up before network available

If you're running your action runners on a service mesh like Istio, you might
have problems with runner configuration accompanied by logs like:

```
....
runner Starting Runner listener with startup type: service
runner Started listener process
runner An error occurred: Not configured
runner Runner listener exited with error code 2
runner Runner listener exit with retryable error, re-launch runner in 5 seconds.
....
```

This is because the `istio-proxy` has not completed configuring itself when the
configuration script tries to communicate with the network.

**Solution**<br />

> This feature is experimental and will be dropped once maintainers think that
> everyone has already migrated to ues Istio's `holdApplicationUntilProxyStarts` ([istio/istio#11130](https://github.com/istio/istio/issues/11130)).
>
> Please read the discussion in #592 for more information.

You can add a delay to the entrypoint script by setting the `STARTUP_DELAY` environment
variable. This will cause the script to sleep `STARTUP_DELAY` seconds.

*Example `Runner` with a 2 second startup delay:*
```yaml
apiVersion: actions.summerwind.dev/v1alpha1
kind: Runner
metadata:
name: example-runner-with-sleep
spec:
env:
- name: STARTUP_DELAY
value: "2" # Remember! env var values must be strings.
```

*Example `RunnerDeployment` with a 2 second startup delay:*
```yaml
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: example-runnerdeployment-with-sleep
spec:
template:
spec:
env:
- name: STARTUP_DELAY
value: "2" # Remember! env var values must be strings.
```


# Contributing

For more details about any requirements or process, please check out [Getting Started with Contributing](CONTRIBUTING.md).
Expand Down
5 changes: 5 additions & 0 deletions runner/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

if [ ! -z "${STARTUP_DELAY}" ]; then
echo "Delaying startup by ${STARTUP_DELAY} seconds" 1>&2
sleep ${STARTUP_DELAY}
fi

if [ -z "${GITHUB_URL}" ]; then
echo "Working with public GitHub" 1>&2
GITHUB_URL="https://github.com/"
Expand Down