Skip to content

Commit

Permalink
Rename DRONE_REPO_OWNER to DRONE_REPO_NAMESPACE (#41)
Browse files Browse the repository at this point in the history
* Rename DRONE_REPO_OWNER to DRONE_REPO_NAMESPACE
* Preserve --repo.owner for backwards-compatability

Also add versioning documentation in CLI flag description / Go metadata
typedef.
  • Loading branch information
hulloitskai authored and kakkoyun committed Jun 11, 2019
1 parent 75b1c2d commit f20a2ea
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 44 deletions.
15 changes: 8 additions & 7 deletions DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ Following metadata object is available and pre-populated with current build info
```go
{
Repo {
Avatar string "repository avatar [$DRONE_REPO_AVATAR]"
Branch string "repository default branch [$DRONE_REPO_BRANCH]"
Link string "repository link [$DRONE_REPO_LINK]"
Name string "repository name [$DRONE_REPO_NAME]"
Owner string "repository owner [$DRONE_REPO_OWNER]"
Private bool "repository is private [$DRONE_REPO_PRIVATE]"
Trusted bool "repository is trusted [$DRONE_REPO_TRUSTED]"
Avatar string "repository avatar [$DRONE_REPO_AVATAR]"
Branch string "repository default branch [$DRONE_REPO_BRANCH]"
Link string "repository link [$DRONE_REPO_LINK]"
Name string "repository name [$DRONE_REPO_NAME]"
Owner string "repository owner [$DRONE_REPO_NAMESPACE]"
Namespace string "repository namespace [$DRONE_REPO_NAMESPACE]"
Private bool "repository is private [$DRONE_REPO_PRIVATE]"
Trusted bool "repository is trusted [$DRONE_REPO_TRUSTED]"
}

Build {
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# drone-cache

[![semver](https://img.shields.io/badge/semver-1.0.2-blue.svg?cacheSeconds=2592000)](https://github.com/meltwater/drone-cache/releases) [![Maintenance](https://img.shields.io/maintenance/yes/2019.svg)](https://github.com/meltwater/drone-cache/commits/master) [![Drone](https://cloud.drone.io/api/badges/meltwater/drone-cache/status.svg)](https://cloud.drone.io/meltwater/drone-cache) [![Go Doc](https://godoc.org/github.com/meltwater/drone-cache?status.svg)](http://godoc.org/github.com/meltwater/drone-cache) [![Go Report Card](https://goreportcard.com/badge/github.com/meltwater/drone-cache)](https://goreportcard.com/report/github.com/meltwater/drone-cache) [![](https://images.microbadger.com/badges/image/meltwater/drone-cache.svg)](https://microbadger.com/images/meltwater/drone-cache) [![](https://images.microbadger.com/badges/version/meltwater/drone-cache.svg)](https://microbadger.com/images/meltwater/drone-cache)

<p align="center"><img src="images/drone_gopher.png" width="400"></p>
Expand All @@ -26,7 +26,7 @@ With restored dependencies from a cache, commands like `mix deps.get` will only

## Example Usage of drone-cache

The following `.drone.yml` configuration show the most common use of drone-cache.
The following `.drone.yml` configuration show the most common use of drone-cache.

Note: These configs use drone 1.0 syntax. If you are using drone 0.8, check the examples in [docs/examples/drone-0.8.md](docs/examples/drone-0.8.md).

Expand Down Expand Up @@ -80,8 +80,8 @@ steps:

### Other Examples

* examples for Drone 0.8, see [docs/examples/drone-0.8.md](docs/examples/drone-0.8.md)
* examples for Drone 1.0, see [docs/examples/drone-1.0.md](docs/examples/drone-1.0.md)
- examples for Drone 0.8, see [docs/examples/drone-0.8.md](docs/examples/drone-0.8.md)
- examples for Drone 1.0, see [docs/examples/drone-1.0.md](docs/examples/drone-1.0.md)

## Usage

Expand All @@ -102,6 +102,7 @@ COMMANDS:

GLOBAL OPTIONS:
--repo.fullname value, --rf value repository full name [$DRONE_REPO]
--repo.namespace value, --rns value repository namespace [$DRONE_REPO_NAMESPACE]
--repo.owner value, --ro value repository owner [$DRONE_REPO_OWNER]
--repo.name value, --rn value repository name [$DRONE_REPO_NAME]
--repo.link value, --rl value repository link [$DRONE_REPO_LINK]
Expand Down Expand Up @@ -211,32 +212,31 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc

## Future work

* [ ] Add s/FTP Backend
* [ ] Fix goreleaser/drone/docker conflicts or remove redundancy with Drone jsonnet
* [ ] Add cache key fallback list
* [ ] Flush or TTL/Retention policy
* [ ] Add Google Cloud Storage Backend
* [ ] Add Microsoft Azure Storage Backend
* [ ] Add unit tests
- [ ] Add s/FTP Backend
- [ ] Fix goreleaser/drone/docker conflicts or remove redundancy with Drone jsonnet
- [ ] Add cache key fallback list
- [ ] Flush or TTL/Retention policy
- [ ] Add Google Cloud Storage Backend
- [ ] Add Microsoft Azure Storage Backend
- [ ] Add unit tests

## Versioning

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/meltwater/drone-cache/tags).

## Authors and Acknowledgement

* [@dim](https://github.com/dim) - Thanks for [original work](https://github.com/bsm/drone-s3-cache)!
* [@kakkoyun](https://github.com/kakkoyun)
* [@salimane](https://github.com/salimane)
* [@AdamGlazerMW](https://github.com/AdamGlazerMW) - Special thanks to Adam for the amazing artwork!
- [@dim](https://github.com/dim) - Thanks for [original work](https://github.com/bsm/drone-s3-cache)!
- [@kakkoyun](https://github.com/kakkoyun)
- [@salimane](https://github.com/salimane)
- [@AdamGlazerMW](https://github.com/AdamGlazerMW) - Special thanks to Adam for the amazing artwork!

Also see the list of [all contributors](https://github.com/meltwater/drone-cache/graphs/contributors).


### Inspiration

* https://github.com/bsm/drone-s3-cache (original work)
* https://github.com/Drillster/drone-volume-cache
- https://github.com/bsm/drone-s3-cache (original work)
- https://github.com/Drillster/drone-volume-cache

## License and Copyright

Expand Down
4 changes: 2 additions & 2 deletions docs/cache_key_templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Following metadata object is available and pre-populated with current build info
Avatar string "repository avatar [$DRONE_REPO_AVATAR]"
Branch string "repository default branch [$DRONE_REPO_BRANCH]"
Link string "repository link [$DRONE_REPO_LINK]"
Name string "repository name [$DRONE_REPO_NAME]"
Owner string "repository owner [$DRONE_REPO_OWNER]"
Name string "repository name [$DRONE_REPO_NAMESPACE]"
Namespace string "repository namespace [$DRONE_REPO_NAMESPACE]"
Private bool "repository is private [$DRONE_REPO_PRIVATE]"
Trusted bool "repository is trusted [$DRONE_REPO_TRUSTED]"
}
Expand Down
26 changes: 16 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func main() {
app.Name = "Drone cache plugin"
app.Usage = "Drone cache plugin"
app.Action = run
app.Version = "1.0.2"
app.Version = "1.0.3"
app.Flags = []cli.Flag{
// Repo args

Expand All @@ -26,8 +26,13 @@ func main() {
EnvVar: "DRONE_REPO",
},
cli.StringFlag{
Name: "repo.owner, ro",
Usage: "repository owner",
Name: "repo.namespace, rns",
Usage: "repository namespace",
EnvVar: "DRONE_REPO_NAMESPACE",
},
cli.StringFlag{
Name: "repo.owner, owner",
Usage: "repository owner (for Drone version < 1.0)",
EnvVar: "DRONE_REPO_OWNER",
},
cli.StringFlag{
Expand Down Expand Up @@ -288,13 +293,14 @@ func run(c *cli.Context) error {
plg := plugin.Plugin{
Metadata: metadata.Metadata{
Repo: metadata.Repo{
Owner: c.String("repo.owner"),
Name: c.String("repo.name"),
Link: c.String("repo.link"),
Avatar: c.String("repo.avatar"),
Branch: c.String("repo.branch"),
Private: c.Bool("repo.private"),
Trusted: c.Bool("repo.trusted"),
Namespace: c.String("repo.namespace"),
Owner: c.String("repo.owner"),
Name: c.String("repo.name"),
Link: c.String("repo.link"),
Avatar: c.String("repo.avatar"),
Branch: c.String("repo.branch"),
Private: c.Bool("repo.private"),
Trusted: c.Bool("repo.trusted"),
},
Build: metadata.Build{
Number: c.Int("build.number"),
Expand Down
15 changes: 8 additions & 7 deletions metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package metadata
type (
// Repo stores information about repository that is built
Repo struct {
Avatar string
Branch string
Link string
Name string
Owner string
Private bool
Trusted bool
Avatar string
Branch string
Link string
Name string
Namespace string // used by Drone versions >= 1.0
Owner string // used by Drone versions < 1.0
Private bool
Trusted bool
}

// Build stores information about current build
Expand Down

0 comments on commit f20a2ea

Please sign in to comment.