Skip to content

Commit

Permalink
docs: include the use of the dependencies property in a GitLab job to…
Browse files Browse the repository at this point in the history
… prevent a dirty repository (#261)
  • Loading branch information
ga-paul-t authored Oct 4, 2022
1 parent 0361b04 commit c942dce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docs/ci/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

An example YAML file for configuring Uplift to run on [GitLab](https://gitlab.com/). To ensure Uplift can push changes back to your repository, you will need to provide it with a [project](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html)](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html) or [group](https://docs.gitlab.com/ee/user/group/settings/group_access_tokens.html) access token[^1] with the `write_repository` permission.

```yaml
```{ .yaml .annotate linenums="1" hl_lines="11" }
# .gitlab-ci.yml
stages:
Expand All @@ -13,6 +13,7 @@ release:
image:
name: gembaadvantage/uplift
entrypoint: [""]
dependencies: [] # (1)
before_script:
- PROJECT_URL=${CI_PROJECT_URL#"https://"}
- git remote set-url origin "https://oauth2:${GL_UPLIFT}@${PROJECT_URL}.git"
Expand All @@ -31,6 +32,8 @@ release:
when: on_success
```

1. Prevents any dependencies, such as reports, from being unnecessarily copied into this job and causing the git checks to fail

To expose your access token within your pipeline you should add a CI/CD [variable](https://docs.gitlab.com/ee/ci/variables/). In the above example, the access token is exposed through the `GL_UPLIFT` variable.

[^1]: It is best security practice to create an access token with the shortest possible expiration date.
2 changes: 1 addition & 1 deletion docs/ci/travisci.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

An example YAML file for configuring Uplift to run on [Travis CI](https://www.travis-ci.com/). Access to GitHub is managed through their dedicated [GitHub Application](https://docs.travis-ci.com/user/tutorial/#to-get-started-with-travis-ci-using-github). Uplift requires write permissions to your repository, a [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) needs to be configured with the `public_repo` permission and added to Travis CI as an [encrypted variable](https://docs.travis-ci.com/user/environment-variables/#defining-encrypted-variables-in-travisyml).

```yaml
```{ .yaml .annotate linenums="1" }
# .travis.yml
# Setup the pipeline based on your chosen language
Expand Down

0 comments on commit c942dce

Please # to comment.