• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wooga / atlas-secrets / 15
78%
master: 92%

Build:
Build:
LAST BUILD BRANCH: release/1.x
DEFAULT BRANCH: master
Ran 23 Nov 2021 10:55AM UTC
Jobs 1
Files 26
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
15

push

jenkins

Improve API usage of SecretResolveChain in secrets extension (#301)

Description
===========

The initial idea of configuring resolvers for the global resolver
was to declare a static chain in the `secrets` extension and
use the `List` interface to be able to `add`,`remove` resolver.

```groovy
secrets.secretResolverChain {
    add(new wooga.gradle.secrets.internal.EnvironmentResolver())
}
```

I don't want to see imports or calls to `new` in `build.gradle` files.
The last patch also brought in the `SecretResolverFactory` which was geared
towards this specific usecase. I thought that a construct like:

```groovy
secrets.secretResolverChain {
    add(secrets.environmentResolver())
}
```

But this leads to scoping issues because the call with a closure is not
actually running like groovy would execute a clojure with `with` for example.
Means that the passed closure can't see the secrets extension or the project.
Which means that it can't reach the factory method in the extension.

Because the `SecretResolverFactory` is a simple standalone `trait` object
I'm able to implement into any class. So I did just that and added the `trait`
to the `SecretResolverChain`. This allow now to configure the chain resolver like this:

```groovy
secrets.secretResolverChain {
    add(environmentResolver())
}
```

I think that is a nice and simple solution.
After this I took another look at the `SecretResolverFactory` and
decided to add some more overloads to pass the aws region as `String`.

```groovy
secrets.secretResolverChain {
    add((awsSecretResolver("eu-west-2"))
}
```

This just helps to reduce friction for simple configurations.

Changes
=======

* ![IMPROVE] `SecretResolverChain` API with implemented `SecretResolverFactory` trait
* ![ADD] `secretText(String secretId)` method to extension
* ![IMPROVE] `Depricate` method `secretValue(String secretId). Will be removed with `1.0.0` release

135 of 173 relevant lines covered (78.03%)

0.78 hits per line

Jobs
ID Job ID Ran Files Coverage
1 15.1 23 Nov 2021 10:55AM UTC 0
78.03
Source Files on build 15
Detailed source file information is not available for this build.
  • Back to Repo
  • Jenkins Build #15
  • 07a96e1a on github
  • Prev Build on release/1.x (#13)
  • Next Build on release/1.x (#17)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc