Skip to content

Commit

Permalink
feat: Add docker-network input param (#853)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Kriese <[email protected]>
  • Loading branch information
taraspos and viceice authored Jul 1, 2024
1 parent f9e5140 commit c928c7f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GitHub Action to run Renovate self-hosted.
- [Options](#options)
- [`configurationFile`](#configurationfile)
- [`docker-cmd-file`](#docker-cmd-file)
- [`docker-network`](#docker-network)
- [`docker-user`](#docker-user)
- [`docker-volumes`](#docker-volumes)
- [`env-regex`](#env-regex)
Expand Down Expand Up @@ -105,6 +106,13 @@ jobs:
token: ${{ secrets.RENOVATE_TOKEN }}
```
### `docker-network`

Specify a network to run container in.

You can use `${{ job.container.network }}` to run renovate container [in the same network as other containers for this job](https://docs.github.com/en/actions/learn-github-actions/contexts#job-context),
or set it to `host` to run in the same network as github runner, or specify any custom network.

### `docker-user`

Specify a user (or user-id) to run docker command.
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ inputs:
description: |
Override docker command. Default command is `renovate`
required: false
docker-network:
description: |
Docker network.
required: false
docker-user:
description: |
Docker user. Default to an unprivileged user
Expand Down
4 changes: 4 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ class Input {
.filter((v) => !!v);
}

getDockerNetwork(): string {
return core.getInput('docker-network');
}

/**
* Convert to environment variables.
*
Expand Down
5 changes: 5 additions & 0 deletions src/renovate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class Renovate {
dockerArguments.push(`--volume ${volumeMount}`);
}

const dockerNetwork = this.input.getDockerNetwork();
if (dockerNetwork) {
dockerArguments.push(`--network ${dockerNetwork}`);
}

dockerArguments.push('--rm', this.docker.image());

if (dockerCmd !== null) {
Expand Down

0 comments on commit c928c7f

Please sign in to comment.