Skip to content

Commit ea855a8

Browse files
committed
Document dependency requirements and secret opt-in behaviour
Record the raised octokit lower bound and the new rbnacl/libsodium runtime requirement in the changelog and README, document the per-secret Dependabot opt-in, and note that destroying an environment is irreversible.
1 parent 6cb78d0 commit ea855a8

2 files changed

Lines changed: 47 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ and this project adheres to
1212

1313
* New `secrets` task group, defined via `RakeGithub.define_secrets_tasks`, for
1414
managing GitHub repository secrets. It exposes `provision`, `destroy` and
15-
`ensure` tasks. Each secret is written to both the Actions and Dependabot
16-
secret stores so that Dependabot-triggered workflow runs can read them.
15+
`ensure` tasks. Each secret is written to the Actions secret store, and
16+
additionally to the Dependabot secret store when it sets `dependabot: true`,
17+
so that Dependabot-triggered workflow runs can read the secrets they need.
1718

1819
Secrets are supplied as an array of hashes, e.g.
1920
`[{ name: 'SOME_SECRET', value: 'plaintext' }]`, and are encrypted
@@ -39,6 +40,14 @@ and this project adheres to
3940

4041
* The `pull_requests:merge` task no longer requires setting the branch name and
4142
commit message provide via arguments as parameters within the task definition.
43+
* The `octokit` dependency lower bound has been raised from `>= 4.16` to
44+
`>= 7.0`, as the Dependabot secret methods used by the `secrets` task group
45+
were introduced in octokit 7.0. Consumers pinning octokit below 7.0 will need
46+
to relax that constraint.
47+
* Added a new runtime dependency on `rbnacl` (`~> 7.1`), used to encrypt
48+
secrets client-side. `rbnacl` requires the native libsodium library to be
49+
installed on the host (see the Installation section of the README); this is
50+
only needed when using the `secrets` task group.
4251

4352
## [0.9.0] 2022-01-28
4453

README.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@ Or install it yourself as:
1818

1919
$ gem install rake_github
2020

21+
### System dependencies
22+
23+
The `secrets` task group encrypts secrets client-side using `rbnacl`, which
24+
requires the native [libsodium](https://libsodium.org) library to be present on
25+
the host. Install it before running any `secrets` task:
26+
27+
# macOS
28+
$ brew install libsodium
29+
30+
# Debian/Ubuntu
31+
$ apt-get install libsodium23
32+
33+
libsodium is only required when using the `secrets` tasks; the other task groups
34+
have no additional system dependencies.
35+
2136
## Usage
2237

2338
### define_deploy_keys_tasks
@@ -52,7 +67,7 @@ end
5267
| deploy_keys_destroy_task_name | symbol | N | Option to change the destroy task name | :obliterate | :destroy |
5368
| deploy_keys_provision_task_name | symbol | N | Option to change the provision task name | :add | :provision |
5469
| deploy_keys_ensure_task_name | symbol | N | Option to change the ensure task name | :destroy_and_provision | :ensure |
55-
| secrets | array | N | Secrets to provision on the repository | { name: string, value: string } | [ ] |
70+
| secrets | array | N | Secrets to provision on the repository | { name: string, value: string, dependabot: bool } | [ ] |
5671
| secrets_namespace | symbol | N | Namespace to contain secrets tasks | :repository_secrets | :secrets |
5772
| secrets_destroy_task_name | symbol | N | Option to change the secrets destroy task name | :obliterate | :destroy |
5873
| secrets_provision_task_name | symbol | N | Option to change the secrets provision task name | :add | :provision |
@@ -103,9 +118,13 @@ the `%s` placeholder, e.g. `pull_requests:merge[new_feature,"%s [skip ci]"]`.
103118
### define_secrets_tasks
104119

105120
Sets up rake tasks for managing repository secrets. Each secret is written to
106-
both the Actions and Dependabot secret stores, so that Dependabot-triggered
107-
workflow runs can read them. Secrets are encrypted client-side before being
108-
sent to GitHub.
121+
the Actions secret store by default. A secret can additionally be written to the
122+
Dependabot secret store by setting `dependabot: true`, so that
123+
Dependabot-triggered workflow runs can read the secrets they need. Secrets are
124+
encrypted client-side before being sent to GitHub.
125+
126+
These tasks require the native libsodium library to be installed on the host —
127+
see [System dependencies](#system-dependencies) above.
109128

110129
```ruby
111130
require 'rake_github'
@@ -119,6 +138,11 @@ RakeGithub.define_secrets_tasks(
119138
{
120139
name: 'SOME_SECRET',
121140
value: 'some-plaintext-value'
141+
},
142+
{
143+
name: 'SHARED_SECRET',
144+
value: 'another-plaintext-value',
145+
dependabot: true # also write to the Dependabot store
122146
}
123147
]
124148
end
@@ -128,7 +152,7 @@ end
128152
|----------------------|--------|----------|------------------------------------------------------------|---------------------------------------------|------------|
129153
| repository | string | Y | Repository to perform tasks upon | 'organisation/repository_name' | N/A |
130154
| access_token | string | Y | Github token for authorisation | 'ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | N/A |
131-
| secrets | array | N | Secrets to provision on the repository | { name: string, value: string } | [ ] |
155+
| secrets | array | N | Secrets to provision on the repository | { name: string, value: string, dependabot: bool } | [ ] |
132156
| destroy_task_name | symbol | N | Option to change the destroy task name | :obliterate | :destroy |
133157
| provision_task_name | symbol | N | Option to change the provision task name | :add | :provision |
134158
| ensure_task_name | symbol | N | Option to change the ensure task name | :destroy_and_provision | :ensure |
@@ -146,8 +170,9 @@ rake secrets:provision
146170

147171
#### secrets:provision
148172

149-
Provisions the specified secrets to the repository, writing each one to both
150-
the Actions and Dependabot secret stores.
173+
Provisions the specified secrets to the repository, writing each one to the
174+
Actions secret store and, for secrets marked `dependabot: true`, also to the
175+
Dependabot secret store.
151176

152177
#### secrets:destroy
153178

@@ -220,7 +245,10 @@ and user reviewers to their numeric ids.
220245

221246
#### environments:destroy
222247

223-
Destroys the specified environments from the repository.
248+
Destroys the specified environments from the repository. This is irreversible
249+
and also discards each environment's protection rules, environment secrets and
250+
deployment history. `environments:ensure` therefore fully recreates each
251+
environment rather than patching it in place.
224252

225253
#### environments:ensure
226254

0 commit comments

Comments
 (0)