Skip to content

Commit

Permalink
Merge pull request #485 from linear-b/cache
Browse files Browse the repository at this point in the history
cache
  • Loading branch information
PavelLinearB authored Apr 16, 2024
2 parents 5e71619 + a5a6f1b commit a8af723
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# /:\\ gitStream Changelog
All notable changes to this project will be documented in this file.

### 2024.4.16
- Added a cache option for the docker image

### 2024.3.28
- Supporting regular expressions in `config.ignore_repositories`
### 2024.3.14
Expand Down
32 changes: 32 additions & 0 deletions docs/github-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,38 @@ To ensure gitStream runs on self-hosted GitHub Actions runners, follow these ste

4. **Test with a Sample PR**
Create a sample pull request and observe gitStream's behavior. It will use the configured self-hosted runners.

### Caching the Docker Image Using GitHub Cache

gitStream provides an optional method to control the frequency of Docker image downloads per day using GitHub's cache services, helping to manage build resources efficiently. By using the `update_times_a_day` argument, you can specify the number of times the Docker image should be downloaded and cached daily. If this argument is not specified, no caching will occur.
#### Configure Docker Image Caching

Add the `update_times_a_day` parameter to the `Evaluate Rules` step of your gitStream GitHub Actions workflow.

- **Open Your GitHub Actions Workflow File and Modify the `Evaluate Rules` Step:**
Navigate to your `.github/workflows` directory, open gitStream's workflow `yml`, and update the `Evaluate Rules` step. Add the `update_times_a_day` parameter to set the exact times the Docker image is downloaded and cached daily.

- **Example Configuration:**
Here is how you might configure the caching within your workflow:

```yaml
steps:
- name: Evaluate Rules
uses: linear-b/gitstream-github-action@v1
id: rules-engine
with:
full_repository: ${{ github.event.inputs.full_repository }}
head_ref: ${{ github.event.inputs.head_ref }}
base_ref: ${{ github.event.inputs.base_ref }}
client_payload: ${{ github.event.inputs.client_payload }}
installation_id: ${{ github.event.inputs.installation_id }}
resolver_url: ${{ github.event.inputs.resolver_url }}
resolver_token: ${{ github.event.inputs.resolver_token }}
update_times_a_day: 6
```

In this example, the Docker image is set to be downloaded and cached six times a day, distributed evenly across 24 hours (i.e., the image will be downloaded every 4 hours). This parameter can be adjusted to fit your workflow needs and resource management strategies. Without specifying this argument, no caching will be performed.

## Uninstalling gitStream

Configure in your [GitHub organization](https://github.com/apps/gitstream-cm/installations/new){ .md-button }, and choose `Uninstall "gitStream.cm"`

0 comments on commit a8af723

Please sign in to comment.