Compare commits

..

No commits in common. "master" and "feature/templates-jsonnet" have entirely different histories.

206 changed files with 1079 additions and 6264 deletions

View file

@ -9,14 +9,12 @@ platform:
steps:
- name: test
image: golang:1.14.15
image: golang:1.14.4
commands:
- go test ./...
- go build -o /dev/null github.com/drone/drone/cmd/drone-server
- go build -o /dev/null -tags "oss nolimit" github.com/drone/drone/cmd/drone-server
- name: build
image: golang:1.14.15
image: golang:1.14.4
commands:
- sh scripts/build.sh
environment:
@ -50,7 +48,7 @@ platform:
steps:
- name: build
image: golang:1.14.15
image: golang:1.14.4
commands:
- sh scripts/build.sh
environment:
@ -88,7 +86,7 @@ platform:
steps:
- name: build
image: golang:1.14.15
image: golang:1.14.4
commands:
- sh scripts/build.sh
environment:

View file

@ -4,9 +4,9 @@ Bugs or Issues? Please create a new topic in our Discourse forum.
We are migrating all Drone repositories to Discourse for bug tracking.
New GitHub issues may be automatically deleted.
https://community.harness.io/
https://community.harness.io/c/bugs/17
https://community.harness.io/c/ideas/11
https://discourse.drone.io/
https://discourse.drone.io/c/bugs
https://discourse.drone.io/c/ideas
Failing Builds? Please do not use GitHub issues for generic support
questions. Instead please use Stack Overflow:

View file

@ -1,27 +0,0 @@
## Commit Checklist
Thank you for creating a pull request! To help us review / merge this can you make sure that your PR adheres as much as possible to the following.
### The Basics
- Commit is a single logical unit of work, only use multiple commits if doing different tasks
- Commit does not include commented out code or unneeded files
- rebase of main branch
### The Content
- Must include testing for bug or feature
- Must include appropriate documentation changes if it is introducing a new feature or changing existing functionality
- Must pass existing test suites
### The Commit Message
- Short meaningful description (ex: remove deprecated steps)
- Uses the imperative, present tense: "change", not "changed" or "changes"
- Includes motivation for the change, and contrasts its implementation with the previous behavior
### The Pull Request
- What is the reason for this change
- Example usage of the failure for a bug, or configuration and expected output for a feature
- Steps to test the change

84
.github/readme.md vendored
View file

@ -1,56 +1,12 @@
# [Drone](https://www.drone.io/) <img src="https://github.com/drone/brand/blob/master/screenshots/screenshot_build_success.png" style="max-width:100px;" />
**Welcome to the Drone codebase, we are thrilled to have you here!**
Drone is a Continuous Delivery system built on container technology. Drone uses a simple YAML configuration file, a superset of docker-compose, to define and execute Pipelines inside Docker containers.
## What is Drone?
Drone is a continuous delivery system built on container technology. Drone uses a simple YAML build file, to define and execute build pipelines inside Docker containers.
## Table of Contents
<br/>
- [What is Drone?](#what-is-drone)
- [Table of Contents](#table-of-contents)
- [Community and Support](#community-and-support)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Setup Documentation](#setup-documentation)
- [Usage Documentation](#usage-documentation)
- [Example `.drone.yml` build file](#example-droneyml-build-file)
- [Plugin Index](#plugin-index)
- [Documentation and Other Links](#documentation-and-Other-Links)
<img src="https://github.com/drone/brand/blob/master/screenshots/screenshot_build_success.png" style="max-width:100px;" />
## Community and Support
[Harness Community Slack](https://join.slack.com/t/harnesscommunity/shared_invite/zt-y4hdqh7p-RVuEQyIl5Hcx4Ck8VCvzBw) - Join the #drone slack channel to connect with our engineers and other users running Drone CI.
</br>
[Harness Community Forum](https://community.harness.io/) - Ask questions, find answers, and help other users.
</br>
[Report A Bug](https://community.harness.io/c/bugs/17) - Find a bug? Please report in our forum under Drone Bugs. Please provide screenshots and steps to reproduce.
</br>
[Events](https://www.meetup.com/harness/) - Keep up to date with Drone events and check out previous events [here](https://www.youtube.com/watch?v=Oq34ImUGcHA&list=PLXsYHFsLmqf3zwelQDAKoVNmLeqcVsD9o).
Sample Pipeline Configuration:
## Contributing
We encourage you to contribute to Drone! Whether that's joining in on the community slack or discourse, or contributing pull requests / documentation changes or raising issues.
## Code of Conduct
Drone follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
### Setup Documentation
This section of the [documentation](http://docs.drone.io/installation/) will help you install and configure the Drone Server and one or many Runners. A runner is a standalone daemon that polls the server for pending pipelines to execute.
### Usage Documentation
Our [documentation](http://docs.drone.io/getting-started/) can help you get started with the different types of pipelines/builds. There are different runners / plugins / extensions designed for different use cases to help make an efficient and simple build pipeline
### Plugin Index
Plugins are used in build steps to perform actions, eg send a message to slack or push a container to a registry. We have an extensive list of community plugins to customize your build pipeline, you can find those [here](http://plugins.drone.io/).
### Example `.drone.yml` build file.
This build file contains a single pipeline (you can have multiple pipelines too) that builds a go application. The front end with npm. Publishes the docker container to a registry and announces the results to a slack room.
```YAML
```yaml
name: default
kind: pipeline
@ -84,7 +40,7 @@ steps:
username: drone
```
## Documentation and Other Links
Documentation and Other Links:
* Setup Documentation [docs.drone.io/installation](http://docs.drone.io/installation/)
* Usage Documentation [docs.drone.io/getting-started](http://docs.drone.io/getting-started/)
@ -93,30 +49,4 @@ steps:
* Build the Enterprise Edition [BUILDING](https://github.com/drone/drone/blob/master/BUILDING)
* Build the Community Edition [BUILDING_OSS](https://github.com/drone/drone/blob/master/BUILDING_OSS)
## Building from source
We have two versions available: the [Enterprise Edition](https://github.com/drone/drone/blob/master/BUILDING) and the [Community Edition](https://github.com/drone/drone/blob/master/BUILDING_OSS)
## Release procedure
Run the changelog generator.
```BASH
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u drone -p drone -t <secret github token>
```
You can generate a token by logging into your GitHub account and going to Settings -> Personal access tokens.
Next we tag the PR's with the fixes or enhancements labels. If the PR does not fulfill the requirements, do not add a label.
**Before moving on make sure to update the version file `version/version.go && version/version_test.go`.**
Run the changelog generator again with the future version according to semver.
```BASH
docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator -u harness -p drone -t <secret token> --future-release v1.0.0
```
Create your pull request for the release. Get it merged then tag the release.
[⬆ Back to Top](#table-of-contents)
_Please note the official Docker images run the Drone Enterprise distribution. If you would like to run the Community Edition you can build from source by following the instructions in [BUILDING_OSS](https://github.com/drone/drone/blob/master/BUILDING_OSS)._

View file

@ -1,3 +0,0 @@
since-tag=v2.0.4
issues=false

2
.gitignore vendored
View file

@ -1,5 +1,4 @@
.vscode
__debug_bin
*.sqlite
*.txt
*.out
@ -10,4 +9,3 @@ release/
scripts/*.go
docker/**/data
TODO*
.idea

View file

@ -2,6 +2,8 @@
2. Install go 1.11 or later with Go modules enabled
3. Install binaries to $GOPATH/bin
go install github.com/drone/drone/cmd/drone-agent
go install github.com/drone/drone/cmd/drone-controller
go install github.com/drone/drone/cmd/drone-server
4. Start the server at localhost:8080

View file

@ -1,327 +1,4 @@
# Changelog
## [v2.12.1](https://github.com/harness/drone/tree/v2.12.1) (2022-06-15)
[Full Changelog](https://github.com/harness/drone/compare/v2.12.0...v2.12.1)
**Fixed bugs:**
- \(bug\) - fix original template scripts & remove amend scripts [\#3229](https://github.com/harness/drone/pull/3229) ([eoinmcafee00](https://github.com/eoinmcafee00))
- \(bug\) - remove unique index on template name [\#3226](https://github.com/harness/drone/pull/3226) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Added OAuth2 token refresher for Gitlab [\#3215](https://github.com/harness/drone/pull/3215) ([EndymionWight](https://github.com/EndymionWight))
**Merged pull requests:**
- \(maint\) fix starlark test on windows [\#3230](https://github.com/harness/drone/pull/3230) ([tphoney](https://github.com/tphoney))
- \(maint\) fix unit tests so they pass on windows [\#3228](https://github.com/harness/drone/pull/3228) ([tphoney](https://github.com/tphoney))
- Update Readme to Fix Typo [\#3223](https://github.com/harness/drone/pull/3223) ([hrittikhere](https://github.com/hrittikhere))
- \(bug\) add unit test for comments in template file [\#3221](https://github.com/harness/drone/pull/3221) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Bump scm version to v1.24.0 [\#3219](https://github.com/harness/drone/pull/3219) ([kit101](https://github.com/kit101))
## [v2.12.0](https://github.com/harness/drone/tree/v2.12.0) (2022-05-16)
[Full Changelog](https://github.com/harness/drone/compare/v2.11.1...v2.12.0)
**Implemented enhancements:**
- bump SCM version to v1.21.1 [\#3204](https://github.com/harness/drone/pull/3204) ([d1wilko](https://github.com/d1wilko))
- bump ui version [\#3202](https://github.com/harness/drone/pull/3202) ([d1wilko](https://github.com/d1wilko))
**Fixed bugs:**
- \(fix\) update drone ui to 2.8.2 [\#3211](https://github.com/harness/drone/pull/3211) ([tphoney](https://github.com/tphoney))
- \(dron-267\) correctly set parent for promotion retry [\#3210](https://github.com/harness/drone/pull/3210) ([tphoney](https://github.com/tphoney))
**Merged pull requests:**
- release prep v2.12.0 [\#3214](https://github.com/harness/drone/pull/3214) ([tphoney](https://github.com/tphoney))
- fixing URL [\#3208](https://github.com/harness/drone/pull/3208) ([dnielsen](https://github.com/dnielsen))
- update community information with updated links [\#3199](https://github.com/harness/drone/pull/3199) ([mrsantons](https://github.com/mrsantons))
## [v2.11.1](https://github.com/harness/drone/tree/v2.11.1) (2022-03-15)
[Full Changelog](https://github.com/harness/drone/compare/v2.11.0...v2.11.1)
**Fixed bugs:**
- ignore nil repos in list and add better debugging [\#3196](https://github.com/harness/drone/pull/3196) ([d1wilko](https://github.com/d1wilko))
**Merged pull requests:**
- \(maint\) release prep for 2.11.1 [\#3197](https://github.com/harness/drone/pull/3197) ([d1wilko](https://github.com/d1wilko))
## [v2.11.0](https://github.com/harness/drone/tree/v2.11.0) (2022-03-08)
[Full Changelog](https://github.com/harness/drone/compare/v2.10.0...v2.11.0)
**Implemented enhancements:**
- bump UI and SCM versions [\#3193](https://github.com/harness/drone/pull/3193) ([d1wilko](https://github.com/d1wilko))
**Merged pull requests:**
- \(maint\) release prep for 2.11.0 [\#3194](https://github.com/harness/drone/pull/3194) ([d1wilko](https://github.com/d1wilko))
## [v2.10.0](https://github.com/harness/drone/tree/v2.10.0) (2022-03-03)
[Full Changelog](https://github.com/harness/drone/compare/v2.9.1...v2.10.0)
**Implemented enhancements:**
- bump UI version to v2.7.0 [\#3190](https://github.com/harness/drone/pull/3190) ([d1wilko](https://github.com/d1wilko))
- bump UI version to v2.6.2 [\#3188](https://github.com/harness/drone/pull/3188) ([d1wilko](https://github.com/d1wilko))
**Merged pull requests:**
- \(maint\) release prep for 2.10.0 [\#3191](https://github.com/harness/drone/pull/3191) ([d1wilko](https://github.com/d1wilko))
## [v2.9.1](https://github.com/harness/drone/tree/v2.9.1) (2022-01-27)
[Full Changelog](https://github.com/harness/drone/compare/v2.9.0...v2.9.1)
**Fixed bugs:**
- bump ui version 2.6.1 [\#3185](https://github.com/harness/drone/pull/3185) ([d1wilko](https://github.com/d1wilko))
**Merged pull requests:**
- \(maint\) release prep for 2.9.1 [\#3186](https://github.com/harness/drone/pull/3186) ([tphoney](https://github.com/tphoney))
## [v2.9.0](https://github.com/harness/drone/tree/v2.9.0) (2022-01-26)
[Full Changelog](https://github.com/harness/drone/compare/v2.8.0...v2.9.0)
**Implemented enhancements:**
- bump ui to v2.6.0 [\#3183](https://github.com/harness/drone/pull/3183) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Merged pull requests:**
- release prep for v2.9.0 [\#3184](https://github.com/harness/drone/pull/3184) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.8.0](https://github.com/harness/drone/tree/v2.8.0) (2022-01-11)
[Full Changelog](https://github.com/harness/drone/compare/v2.7.3...v2.8.0)
**Implemented enhancements:**
- bump UI to v2.5.0 [\#3180](https://github.com/harness/drone/pull/3180) ([eoinmcafee00](https://github.com/eoinmcafee00))
- \(feat\) ignore archive repos on sync [\#3178](https://github.com/harness/drone/pull/3178) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Datadog add the tag of 'remote:gitee' [\#3174](https://github.com/harness/drone/pull/3174) ([kit101](https://github.com/kit101))
- Add tag filter when call build list endpoint [\#3173](https://github.com/harness/drone/pull/3173) ([michelangelomo](https://github.com/michelangelomo))
**Fixed bugs:**
- \(maint\) add warning around typo for stage\_id in step struct [\#3179](https://github.com/harness/drone/pull/3179) ([tphoney](https://github.com/tphoney))
**Merged pull requests:**
- release prep v2.8.0 [\#3181](https://github.com/harness/drone/pull/3181) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.7.3](https://github.com/harness/drone/tree/v2.7.3) (2021-12-30)
[Full Changelog](https://github.com/harness/drone/compare/v2.7.2...v2.7.3)
**Fixed bugs:**
- bump go-scm to v1.16.3 [\#3175](https://github.com/harness/drone/pull/3175) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Merged pull requests:**
- release prep v2.7.3 [\#3176](https://github.com/harness/drone/pull/3176) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.7.2](https://github.com/harness/drone/tree/v2.7.2) (2021-12-19)
[Full Changelog](https://github.com/harness/drone/compare/v2.7.1...v2.7.2)
**Implemented enhancements:**
- bump go-scm to v1.16.2 [\#3169](https://github.com/harness/drone/pull/3169) ([kit101](https://github.com/kit101))
**Fixed bugs:**
- fixbug gitee provide refresher [\#3168](https://github.com/harness/drone/pull/3168) ([kit101](https://github.com/kit101))
**Merged pull requests:**
- release prep 2.7.2 [\#3172](https://github.com/harness/drone/pull/3172) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.7.1](https://github.com/harness/drone/tree/v2.7.1) (2021-12-17)
[Full Changelog](https://github.com/harness/drone/compare/v2.7.0...v2.7.1)
**Fixed bugs:**
- fixes issue with redirects on double slashes in url [\#3170](https://github.com/harness/drone/pull/3170) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Merged pull requests:**
- release prep v2.7.1 [\#3171](https://github.com/harness/drone/pull/3171) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.7.0](https://github.com/harness/drone/tree/v2.7.0) (2021-12-15)
[Full Changelog](https://github.com/harness/drone/compare/v2.6.0...v2.7.0)
**Implemented enhancements:**
- bump UI to v2.4.1 [\#3167](https://github.com/harness/drone/pull/3167) ([d1wilko](https://github.com/d1wilko))
**Fixed bugs:**
- \(DRON-157\) use deploy string in deployment [\#3165](https://github.com/harness/drone/pull/3165) ([tphoney](https://github.com/tphoney))
**Merged pull requests:**
- release v2.7.0 [\#3166](https://github.com/harness/drone/pull/3166) ([d1wilko](https://github.com/d1wilko))
## [v2.6.0](https://github.com/harness/drone/tree/v2.6.0) (2021-11-30)
[Full Changelog](https://github.com/harness/drone/compare/v2.5.0...v2.6.0)
**Implemented enhancements:**
- Feat: implemented gitee client [\#3156](https://github.com/harness/drone/pull/3156) ([kit101](https://github.com/kit101))
**Merged pull requests:**
- release prep for v2.6.0 [\#3163](https://github.com/harness/drone/pull/3163) ([tphoney](https://github.com/tphoney))
## [v2.5.0](https://github.com/harness/drone/tree/v2.5.0) (2021-11-17)
[Full Changelog](https://github.com/harness/drone/compare/v2.4.0...v2.5.0)
**Implemented enhancements:**
- bump ui to v2.4.0 [\#3160](https://github.com/harness/drone/pull/3160) ([eoinmcafee00](https://github.com/eoinmcafee00))
- add new endpoint for uploading cards [\#3159](https://github.com/harness/drone/pull/3159) ([eoinmcafee00](https://github.com/eoinmcafee00))
- refactor create / find / delete end points for cards [\#3158](https://github.com/harness/drone/pull/3158) ([eoinmcafee00](https://github.com/eoinmcafee00))
- bump ui to v2.3.1 [\#3155](https://github.com/harness/drone/pull/3155) ([d1wilko](https://github.com/d1wilko))
- provide ability to create/read/store card data in drone server [\#3149](https://github.com/harness/drone/pull/3149) ([eoinmcafee00](https://github.com/eoinmcafee00))
- \(DRON-124\) adding new status endpoint [\#3143](https://github.com/harness/drone/pull/3143) ([tphoney](https://github.com/tphoney))
**Fixed bugs:**
- fix a typo in readme [\#3150](https://github.com/harness/drone/pull/3150) ([nothatDinger](https://github.com/nothatDinger))
**Merged pull requests:**
- release prep for v2.5.0 [\#3161](https://github.com/harness/drone/pull/3161) ([eoinmcafee00](https://github.com/eoinmcafee00))
## [v2.4.0](https://github.com/harness/drone/tree/v2.4.0) (2021-09-23)
[Full Changelog](https://github.com/harness/drone/compare/v2.3.1...v2.4.0)
**Implemented enhancements:**
- bump ui version to v2.3.0 [\#3146](https://github.com/harness/drone/pull/3146) ([d1wilko](https://github.com/d1wilko))
- verify if the application is buildable [\#3144](https://github.com/harness/drone/pull/3144) ([marko-gacesa](https://github.com/marko-gacesa))
**Fixed bugs:**
- fixes build issue with bitbucket cloud [\#3147](https://github.com/harness/drone/pull/3147) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Fix stepLimit param in Starlark and Template OSS code [\#3141](https://github.com/harness/drone/pull/3141) ([phil-davis](https://github.com/phil-davis))
- fix a broken link in readme [\#3140](https://github.com/harness/drone/pull/3140) ([empire](https://github.com/empire))
**Merged pull requests:**
- \(maint\)-release 2.4.0 [\#3148](https://github.com/harness/drone/pull/3148) ([d1wilko](https://github.com/d1wilko))
- Allow jsonnet imports in pipeline configuration [\#3105](https://github.com/harness/drone/pull/3105) ([hhamalai](https://github.com/hhamalai))
## [v2.3.1](https://github.com/harness/drone/tree/v2.3.1) (2021-09-09)
[Full Changelog](https://github.com/harness/drone/compare/v2.3.0...v2.3.1)
**Implemented enhancements:**
- bump ui to v2.2.1 - https://github.com/drone/drone-ui/blob/main/CHANGELOG.md [\#3138](https://github.com/harness/drone/pull/3138) ([d1wilko](https://github.com/d1wilko))
**Merged pull requests:**
- \(maint\)-release 2.3.1 [\#3139](https://github.com/harness/drone/pull/3139) ([d1wilko](https://github.com/d1wilko))
## [v2.3.0](https://github.com/harness/drone/tree/v2.3.0) (2021-09-09)
[Full Changelog](https://github.com/harness/drone/compare/v2.2.0...v2.3.0)
**Implemented enhancements:**
- bump ui to v2.2.0 - https://github.com/drone/drone-ui/blob/main/CHANGELOG.md [\#3137](https://github.com/harness/drone/pull/3137) ([d1wilko](https://github.com/d1wilko))
- Make starlark step limit configurable [\#3134](https://github.com/harness/drone/pull/3134) ([phil-davis](https://github.com/phil-davis))
- \(feat\) drone h/a: wrapped scheduler's signal func with redis mutex [\#3130](https://github.com/harness/drone/pull/3130) ([marko-gacesa](https://github.com/marko-gacesa))
**Fixed bugs:**
- \(fix\) trim http/s prefixes from config hostnames [\#3136](https://github.com/harness/drone/pull/3136) ([tphoney](https://github.com/tphoney))
- \(fix\) remove unused jwt-go library [\#3129](https://github.com/harness/drone/pull/3129) ([tphoney](https://github.com/tphoney))
## [v2.2.0](https://github.com/harness/drone/tree/v2.2.0) (2021-09-01)
[Full Changelog](https://github.com/harness/drone/compare/v2.1.0...v2.2.0)
**Implemented enhancements:**
- \(maint\) ui version v2.1.0 - https://github.com/drone/drone-ui/blob/main/CHANGELOG.md [\#3132](https://github.com/harness/drone/pull/3132) ([d1wilko](https://github.com/d1wilko))
- Ability to cancel running builds, if a new commit is pushed [\#3126](https://github.com/harness/drone/pull/3126) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Fixed bugs:**
- fix templating reg expression to match if .drone.yml contains --- characters [\#3131](https://github.com/harness/drone/pull/3131) ([eoinmcafee00](https://github.com/eoinmcafee00))
- add check on template extension type - throw error if invalid [\#3128](https://github.com/harness/drone/pull/3128) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Merged pull requests:**
- \(maint\)-release 2.2.0 [\#3133](https://github.com/harness/drone/pull/3133) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Rename files with camelCase name to use snake\_case convention [\#3127](https://github.com/harness/drone/pull/3127) ([marko-gacesa](https://github.com/marko-gacesa))
- event-stream supports timeout [\#3125](https://github.com/harness/drone/pull/3125) ([zc2638](https://github.com/zc2638))
- \(maint\) Readme update Add Contributor Section [\#3111](https://github.com/harness/drone/pull/3111) ([mrsantons](https://github.com/mrsantons))
## [v2.1.0](https://github.com/harness/drone/tree/v2.1.0) (2021-08-24)
[Full Changelog](https://github.com/harness/drone/compare/v2.0.6...v2.1.0)
**Implemented enhancements:**
- \(maint\) ui version v2.0.1. - https://github.com/drone/drone-ui/blob/main/CHANGELOG.md [\#3123](https://github.com/harness/drone/pull/3123) ([d1wilko](https://github.com/d1wilko))
- add support for yaml templates [\#3120](https://github.com/harness/drone/pull/3120) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Fixed bugs:**
- Update error message to forbidden if user membership doesn't exist on repo [\#3122](https://github.com/harness/drone/pull/3122) ([eoinmcafee00](https://github.com/eoinmcafee00))
- update create template path to have namespace, instead of inside the payload [\#3121](https://github.com/harness/drone/pull/3121) ([eoinmcafee00](https://github.com/eoinmcafee00))
- update dependency drone/go-scm to 1.15.2 to fix gitea build problem [\#3118](https://github.com/harness/drone/pull/3118) ([sesky4](https://github.com/sesky4))
**Merged pull requests:**
- \(maint\) v2.1.0 release prep [\#3124](https://github.com/harness/drone/pull/3124) ([d1wilko](https://github.com/d1wilko))
## [v2.0.6](https://github.com/harness/drone/tree/v2.0.6) (2021-08-17)
[Full Changelog](https://github.com/harness/drone/compare/v2.0.5...v2.0.6)
**Merged pull requests:**
- \(maint\) v2.0.6 release prep [\#3119](https://github.com/harness/drone/pull/3119) ([tphoney](https://github.com/tphoney))
## [v2.0.5](https://github.com/harness/drone/tree/v2.0.5) (2021-08-17)
[Full Changelog](https://github.com/harness/drone/compare/v2.0.4...v2.0.5)
**Implemented enhancements:**
- bump ui version [\#3115](https://github.com/harness/drone/pull/3115) ([d1wilko](https://github.com/d1wilko))
- bump ui version [\#3114](https://github.com/harness/drone/pull/3114) ([d1wilko](https://github.com/d1wilko))
- Add support for nested data objects within templates [\#3110](https://github.com/harness/drone/pull/3110) ([eoinmcafee00](https://github.com/eoinmcafee00))
- \(feat\) redis implementation for pub-sub, log streaming and canceller [\#3108](https://github.com/harness/drone/pull/3108) ([marko-gacesa](https://github.com/marko-gacesa))
**Fixed bugs:**
- fix issue where map changes order therefore test randomly fails [\#3112](https://github.com/harness/drone/pull/3112) ([eoinmcafee00](https://github.com/eoinmcafee00))
**Merged pull requests:**
- release 2.0.5 [\#3117](https://github.com/harness/drone/pull/3117) ([eoinmcafee00](https://github.com/eoinmcafee00))
- Update pull\_request\_template.md [\#3107](https://github.com/harness/drone/pull/3107) ([tphoney](https://github.com/tphoney))
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@ -329,40 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
## [2.0.4]
### Fixed
- DRON-97 remove use of request animation frame to prevent high CPU on tab refocus events.
## [2.0.3]
### Fixed
- DONE-91 handle extra slashes in url. [#3009](https://github.com/drone/drone/pull/3099).
## [2.0.2]
### Added
- Merge remote-tracking branch 'origin/master'
- prevent repository list short circuit in UI
- remove deprecated steps from building file [#3097](https://github.com/drone/drone/pull/3097)
- adding depends_on, image and detached fields to step [#3072](https://github.com/drone/drone/pull/3072)
- Add ctx.build.debug boolean [#3082](https://github.com/drone/drone/pull/3082)
- Bump github.com/google/go-jsonnet to v0.17.0 [#3084](https://github.com/drone/drone/pull/3084)
- bump go-scm v1.15.1 [#3096](https://github.com/drone/drone/pull/3096)
- bitbucket server build issue [#3092](https://github.com/drone/drone/pull/3092)
- update scm version [#3091](https://github.com/drone/drone/pull/3091)
- Limit graceful shutdown duration [#3093](https://github.com/drone/drone/pull/3093)
- bump user interface
- bump ui version
- ignore skip directive for promote and rollback events
- new feature: maximum open DB connections is configurable[#3089](https://github.com/drone/drone/pull/3089)
- jsonnet additional parameters [#3087](https://github.com/drone/drone/pull/3087)
- hide login button if user already authenticated
- new feature: configuration templates [#3081](https://github.com/drone/drone/pull/3081)
### Fixed
- various typos [#3088](https://github.com/drone/drone/pull/3088)
- handle error properly if template doesn't exist [#3095](https://github.com/drone/drone/pull/3093)
- oss build issue [#3086](https://github.com/drone/drone/pull/3086)
- graceful shutdown [#3083](https://github.com/drone/drone/pull/3083)
## [2.0.1]
### Added
- support for configuring the internal yaml cache size.
@ -451,13 +94,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- page to view the latest build per branch.
### Fixed
- sync routine not executing asynchronously, being cancelled by http context.
- sync routine not executing asyncronously, being cancelled by http context.
- sync routine should ignore gitlab subrepositories
- convert deploy events in 0.8 yaml to promote events.
- do not execute cron job for disabled repositories. [#2931](https://github.com/drone/drone/issues/2931).
- remove trailing slash from gitea url to prevent oauth2 token refresh errors, by [@cmj0121](https://github.com/cmj0121). [#2920](https://github.com/drone/drone/issues/2920).
- disable font ligatures in build log output. [drone/drone-ui#322](https://github.com/drone/drone-ui/pull/322).
- missing am/pm in timestamps
- missing am/pm in timstamps
## [1.6.5] - 2020-01-29
### Changed
@ -647,6 +290,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- update go-scm to version 1.3.0, by [@bradrydzewski](https://github.com/bradrydzewski).
- update drone-runtime to version to 1.0.4, by [@bradrydzewski](https://github.com/bradrydzewski).
- ping docker daemon before agent starts to ensure connectivity, by [@bradrydzewski](https://github.com/bradrydzewski).
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

View file

@ -1,326 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
## [2.0.4]
### Fixed
- DRON-97 remove use of request animation frame to prevent high CPU on tab refocus events.
## [2.0.3]
### Fixed
- DONE-91 handle extra slashes in url. [#3009](https://github.com/drone/drone/pull/3099).
## [2.0.2]
### Added
- Merge remote-tracking branch 'origin/master'
- prevent repository list short circuit in UI
- remove deprecated steps from building file [#3097](https://github.com/drone/drone/pull/3097)
- adding depends_on, image and detached fields to step [#3072](https://github.com/drone/drone/pull/3072)
- Add ctx.build.debug boolean [#3082](https://github.com/drone/drone/pull/3082)
- Bump github.com/google/go-jsonnet to v0.17.0 [#3084](https://github.com/drone/drone/pull/3084)
- bump go-scm v1.15.1 [#3096](https://github.com/drone/drone/pull/3096)
- bitbucket server build issue [#3092](https://github.com/drone/drone/pull/3092)
- update scm version [#3091](https://github.com/drone/drone/pull/3091)
- Limit graceful shutdown duration [#3093](https://github.com/drone/drone/pull/3093)
- bump user interface
- bump ui version
- ignore skip directive for promote and rollback events
- new feature: maximum open DB connections is configurable[#3089](https://github.com/drone/drone/pull/3089)
- jsonnet additional parameters [#3087](https://github.com/drone/drone/pull/3087)
- hide login button if user already authenticated
- new feature: configuration templates [#3081](https://github.com/drone/drone/pull/3081)
### Fixed
- various typos [#3088](https://github.com/drone/drone/pull/3088)
- handle error properly if template doesn't exist [#3095](https://github.com/drone/drone/pull/3093)
- oss build issue [#3086](https://github.com/drone/drone/pull/3086)
- graceful shutdown [#3083](https://github.com/drone/drone/pull/3083)
## [2.0.1]
### Added
- support for configuring the internal yaml cache size.
## [2.0.0]
### Added
- feature flags for mixed-mode database encryption.
### Changed
- user-interface re-design
### Breaking
- removed deprecated kubernetes integration in favor of official kubernetes runner.
- removed deprecated nomad integration in favor of official nomad runner.
## [1.10.1]
### Added
- support for repository-level concurrency limits.
- support for gitlab and github internal visibility on initial sync.
### Fixed
- create machine user with a custom API token.
## [1.10.0]
### Added
- support for starlark scripts in core.
- support for executing pipelines in debug mode.
## [1.9.2]
### Added
- update go-scm dependency to fix
## [1.9.1]
### Added
- support for increasing the http request timeout for extensions. [#2998](https://github.com/drone/drone/pull/2998).
- support for skipping a pipeline if the validation extension returns an ErrSkip.
- support for blocking a pipeline if the validation extension returns an ErrBlock.
### Fixed
- rollback endpoint should be available to users with write permission.
- retrying a build should re-use custom build parameters from parent build.
## [1.9.0] - 2020-07-12
### Added
- ui support for deployment list and summary.
- ui support for promoting and rolling back builds.
- feature flag to use static secret when signing webhooks, from @chiraggadasc.
### Fixed
- ui branch list improperly capped.
### Changed
- upgrade drone/envsubst dependency
- upgrade drone/go-scm dependency
## [1.8.1] - 2020-06-23
### Fixed
- support for gitea api pagination, repository sync hanging.
## [1.8.0] - 2020-06-10
### Added
- re-assigned repository ownership when deactivating a user.
- re-assigned repository ownership when deleting a user.
- de-activate a repository when deleting a user if re-assignment fails.
- de-activate a repository when deactivating a user if re-assignment fails.
- routine to cleanup builds stuck in a pending state.
- routine to cleanup builds stuck in a running state.
- private mode setting requires authentication to view public repositories.
### Fixed
- canceling a build emits a sql.ErrNoRows error.
- custom token is ignored when creating a user account via the API.
- machine accounts with sufficient permissions can create builds via the API.
### Changed
- upgraded Go toolchain to version 1.14.4.
## [1.7.0] - 2020-03-27
### Added
- endpoint to display the latest build by branch. [#2940](https://github.com/drone/drone/pull/2940).
- endpoint to display the latest build by pull request. [#2940](https://github.com/drone/drone/pull/2940).
- endpoint to display the latest build by environment. [#2940](https://github.com/drone/drone/pull/2940).
- endpoint to delete a branch from the index. [#2940](https://github.com/drone/drone/pull/2940).
- endpoint to delete a pull request from the index. [#2940](https://github.com/drone/drone/pull/2940).
- endpoint to delete an environment from the index. [#2940](https://github.com/drone/drone/pull/2940).
- page to view the latest build per branch.
### Fixed
- sync routine not executing asynchronously, being cancelled by http context.
- sync routine should ignore gitlab subrepositories
- convert deploy events in 0.8 yaml to promote events.
- do not execute cron job for disabled repositories. [#2931](https://github.com/drone/drone/issues/2931).
- remove trailing slash from gitea url to prevent oauth2 token refresh errors, by [@cmj0121](https://github.com/cmj0121). [#2920](https://github.com/drone/drone/issues/2920).
- disable font ligatures in build log output. [drone/drone-ui#322](https://github.com/drone/drone-ui/pull/322).
- missing am/pm in timestamps
## [1.6.5] - 2020-01-29
### Changed
- update version of go-scm
- update alpine version in docker images
- use ticker for cron jobs for more accurate timing
## [1.6.4] - 2019-12-30
### Added
- optionally enable pprof endpoints for profiling, by [@bradrydzewski](https://github.com/bradrydzewski).
## [1.6.3] - 2019-12-10
### Fixed
- disable caching generated yaml files by commit sha, by [@bradrydzewski](https://github.com/bradrydzewski).
### Added
- support for bitbucket skipverify, by [@toni-moreno](https://github.com/toni-moreno).
- support for gitea skipverify, by [@toni-moreno](https://github.com/toni-moreno).
## [1.6.2] - 2019-11-08
### Added
- support for loading license contents from env, by [@bradrydzewski](https://github.com/bradrydzewski).
### Fixed
- regression not converting legacy pipeline when using new runners, by [@bradrydzewski](https://github.com/bradrydzewski).
## [1.6.1] - 2019-10-17
### Added
- updated autocert library in support of acme v2 protocol, by [@bradrydzewski](https://github.com/bradrydzewski).
### Fixed
- fixed nil pointer when manually adding user from api, by [@bradrydzewski](https://github.com/bradrydzewski).
## [1.6.0] - 2019-10-04
### Added
- added nsswitch to docker images
- option to auto-cancel pending builds when newer build enqueued, by [@bradrydzewski](https://github.com/bradrydzewski). [#1980](https://github.com/drone/drone/issues/1980).
- endpoint to list all repositories in the database, by [@bradrydzewski](https://github.com/bradrydzewski). [#2785](https://github.com/drone/drone/issues/2785).
### Fixed
- improve sync to handle duplicate repository names with different unique identifiers, by [@bradrydzewski](https://github.com/bradrydzewski). [#2658](https://github.com/drone/drone/issues/2658). _You can revert to the previous sync logic with DRONE_DATABASE_LEGACY_BATCH=true_.
## [1.5.1] - 2019-09-30
### Added
- allow organization admins access to organization secret endpoints, by [@bradrydzewski](https://github.com/bradrydzewski). [#2838](https://github.com/drone/drone/issues/2838).
### Fixed
- fix invalid deep links in UI for github enterprise, by [@bradrydzewski](https://github.com/bradrydzewski).
- ensure correct casing when manually adding user, by [@bradrydzewski](https://github.com/bradrydzewski). [#2766](https://github.com/drone/drone/issues/2766).
## [1.5.0] - 2019-09-28
### Added
- endpoint to execute a cron pipeline on-demand, by [@bradrydzewski](https://github.com/bradrydzewski). [#2781](https://github.com/drone/drone/issues/2781).
- endpoint to list builds by branch, by [@bradrydzewski](https://github.com/bradrydzewski). [#1495](https://github.com/drone/drone/issues/1495).
- ignore skip comments when cron event, by [@bradrydzewski](https://github.com/bradrydzewski). [#2835](https://github.com/drone/drone/issues/2835).
- support for admission extensions, by [@bradrydzewski](https://github.com/bradrydzewski). [#2043](https://github.com/drone/drone/issues/2043).
- endpoint to provide link to git resources, by [@bradrydzewski](https://github.com/bradrydzewski). [#2843](https://github.com/drone/drone/issues/2843).
- improve bitbucket status display text on new pull request screen, by [@bradrydzewski](https://github.com/bradrydzewski).
### Fixed
- missing cron job name in user interface, by [@bradrydzewski](https://github.com/bradrydzewski).
- log lines not properly wrapping in user interface, by [@bradrydzewski](https://github.com/bradrydzewski).
[#309](https://github.com/drone/drone-ui/issues/309).
### Breaking
- the server now runs in multi-machine mode by default. In order to run the server in single-machine mode (agents disabled) you must set DRONE_AGENTS_DISABLED=true.
## [1.4.0] - 2019-09-12
### Added
- upgrade to Go 1.13 to resolve arm segfault, by [@KN4CK3R](https://github.com/KN4CK3R). [#2823](https://github.com/drone/drone/issues/2823).
- configure default visibility, by [@JordanSussman](https://github.com/JordanSussman). [#2824](https://github.com/drone/drone/issues/2824).
- configure default trusted flag, by [@vyckou](https://github.com/vyckou).
- support for validation plugins, by [@bradrydzewski](https://github.com/bradrydzewski). [#2266](https://github.com/drone/drone/issues/2266).
- support for conversion plugins, by [@bradrydzewski](https://github.com/bradrydzewski).
- support for cron event type, by [@bradrydzewski](https://github.com/bradrydzewski). [#2705](https://github.com/drone/drone/issues/2705).
- support for rollback event, by [@bradrydzewski](https://github.com/bradrydzewski). [#2695](https://github.com/drone/drone/issues/2695).
- support for lets encrypt email, by [@bradrydzewski](https://github.com/bradrydzewski). [#2505](https://github.com/drone/drone/issues/2505).
### Removed
- Support for basic auth as an option for Gitea, by [@techknowlogick](https://giteahub.com/techknowlogick). [#2721](https://github.com/drone/drone/issues/2721)
### Fixed
- copy cron job name when restarting a cron job, by [@bradrydzewski](https://github.com/bradrydzewski). [#2760](https://github.com/drone/drone/issues/2760).
## [1.3.1] - 2019-08-26
### Added
- support for the GitHub deployment status API, by [@bradrydzewski](https://github.com/bradrydzewski).
## [1.3.0] - 2019-08-20
### Added
- support for storing logs in Azure Cloud Storage, by [@Lucretius](https://github.com/Lucretius). [#2788](https://github.com/drone/drone/pull/2788)
- support for windows server 1903, by [@bradrydzewski](https://github.com/bradrydzewski).
- button to view the full log file, by [@dramich](https://github.com/dramich). [drone/drone-ui#287](https://github.com/drone/drone-ui/pull/287).
### Fixed
- read gogs sha from webhook, by [@marcotuna](https://github.com/marcotuna).
- create bind volume on host if not exists, by [@bradrydzewski](https://github.com/bradrydzewski). [#2725](https://github.com/drone/drone/issues/2725).
- preserve whitespace in build logs, by [@geek1011](https://github.com/geek1011). [drone/drone-ui#294](https://github.com/drone/drone-ui/pull/294).
- enable log file download on firefox, by [@bobmanary](https://github.com/bobmanary). [drone/drone-ui#303](https://github.com/drone/drone-ui/pull/303)
### Security
- upgraded to Go 1.12.9 due to CVE-2019-9512 and CVE-2019-9514
## [1.2.3] - 2019-07-30
### Added
- disable github status for cron jobs
- support for action in conditionals, by [@bradrydzewski](https://github.com/bradrydzewski). [#2685](https://github.com/drone/drone/issues/2685).
### Fixed
- improve cancel logic for dangling stages, by [@bradrydzewski](https://github.com/bradrydzewski).
- improve error when kubernetes malforms the port configuration, by [@bradrydzewski](https://github.com/bradrydzewski). [#2742](https://github.com/drone/drone/issues/2742).
- copy parameters from parent build when promoting, by [@bradrydzewski](https://github.com/bradrydzewski). [#2748](https://github.com/drone/drone/issues/2748).
## [1.2.2] - 2019-07-29
### Added
- support for legacy environment variables
- support for legacy workspace based on repository name
- support for github deployment hooks
- provide base sha for github pull requests
- option to filter webhooks by event and type
- upgrade drone-yaml to v1.2.2
- upgrade drone-runtime to v1.0.7
### Fixed
- error when manually creating an empty user, by [@bradrydzewski](https://github.com/bradrydzewski). [#2738](https://github.com/drone/drone/issues/2738).
## [1.2.1] - 2019-06-11
### Added
- support for legacy tokens to ease upgrade path, by [@bradrydzewski](https://github.com/bradrydzewski). [#2713](https://github.com/drone/drone/issues/2713).
- include repository name and id in batch update error message, by [@bradrydzewski](https://github.com/bradrydzewski).
### Fixed
- fix inconsistent base64 encoding and decoding of encrypted secrets, by [@bradrydzewski](https://github.com/bradrydzewski).
- update drone-yaml to version 1.1.2 for improved 0.8 to 1.0 yaml marshal escaping.
- update drone-yaml to version 1.1.3 for improved 0.8 to 1.0 workspace conversion.
## [1.2.0] - 2019-05-30
### Added
- endpoint to trigger new build for default branch, by [@bradrydzewski](https://github.com/bradrydzewski). [#2679](https://github.com/drone/drone/issues/2679).
- endpoint to trigger new build for branch, by [@bradrydzewski](https://github.com/bradrydzewski). [#2679](https://github.com/drone/drone/issues/2679).
- endpoint to trigger new build for branch and sha, by [@bradrydzewski](https://github.com/bradrydzewski). [#2679](https://github.com/drone/drone/issues/2679).
- enable optional prometheus metrics guest access, by [@janberktold](https://github.com/janberktold)
- fallback to database when logs not found in s3, by [@bradrydzewski](https://github.com/bradrydzewski). [#2689](https://github.com/drone/drone/issues/2689).
- support for custom stage definitions and runners, by [@bradrydzewski](https://github.com/bradrydzewski). [#2680](https://github.com/drone/drone/issues/2680).
- update drone-yaml to version 1.1.0
### Fixed
- retrieve latest build by branch, by [@tboerger](https://github.com/tboerger).
- copy the fork value when restarting a build, by [@bradrydzewski](https://github.com/bradrydzewski). [#2708](https://github.com/drone/drone/issues/2708).
- make healthz available without redirect, by [@bradrydzewski](https://github.com/bradrydzewski). [#2706](https://github.com/drone/drone/issues/2706).
## [1.1.0] - 2019-04-23
### Added
- specify a user for the pipeline step, by [@bradrydzewski](https://github.com/bradrydzewski). [#2651](https://github.com/drone/drone/issues/2651).
- support for Gitea oauth2, by [@techknowlogick](https://github.com/techknowlogick). [#2622](https://github.com/drone/drone/pull/2622).
- ping the docker daemon before starting the agent, by [@bradrydzewski](https://github.com/bradrydzewski). [#2495](https://github.com/drone/drone/issues/2495).
- support for Cron job name in Yaml trigger block, by [@bradrydzewski](https://github.com/bradrydzewski). [#2628](https://github.com/drone/drone/issues/2628).
- support for Cron job name in Yaml when block, by [@bradrydzewski](https://github.com/bradrydzewski). [#2628](https://github.com/drone/drone/issues/2628).
- sqlite username column changed to case-insensitive, by [@bradrydzewski](https://github.com/bradrydzewski).
- endpoint to purge repository from database, by [@bradrydzewski](https://github.com/bradrydzewski).
- support for per-organization secrets, by [@bradrydzewski](https://github.com/bradrydzewski).
- include system metadata in global webhooks, by [@bradrydzewski](https://github.com/bradrydzewski).
- ability to customize cookie secure flag, by [@bradrydzewski](https://github.com/bradrydzewski).
- update drone-yaml from version 1.0.6 to 1.0.8.
- update drone-runtime from version 1.0.4 to 1.0.6.
- update go-scm from version 1.0.3 to 1.0.4.
### Fixed
- fixed error in mysql table creation syntax, from [@xuyang2](https://github.com/xuyang2). [#2677](https://github.com/drone/drone/pull/2677).
- fixed stuck builds when upstream dependency is skipped, from [@bradrydzewski](https://github.com/bradrydzewski). [#2634](https://github.com/drone/drone/issues/2634).
- fixed issue running steps with dependencies on failure, from [@bradrydzewski](https://github.com/bradrydzewski). [#2667](https://github.com/drone/drone/issues/2667).
## [1.0.1] - 2019-04-10
### Added
- pass stage environment variables to pipeline steps, by [@bradrydzewski](https://github.com/bradrydzewski).
- update go-scm to version 1.3.0, by [@bradrydzewski](https://github.com/bradrydzewski).
- update drone-runtime to version to 1.0.4, by [@bradrydzewski](https://github.com/bradrydzewski).
- ping docker daemon before agent starts to ensure connectivity, by [@bradrydzewski](https://github.com/bradrydzewski).

View file

@ -21,7 +21,7 @@ Drone Non-Commercial License
Contributor: Drone.IO, Inc.
Source Code: https://github.com/harness/drone
Source Code: https://github.com/drone/drone
This license lets you use and share this software for free,
with a trial-length time limit on commercial use. Specifically:

View file

@ -79,7 +79,6 @@ tasks:
- cmd: go test -count=1 github.com/drone/drone/store/batch
- cmd: go test -count=1 github.com/drone/drone/store/batch2
- cmd: go test -count=1 github.com/drone/drone/store/build
- cmd: go test -count=1 github.com/drone/drone/store/card
- cmd: go test -count=1 github.com/drone/drone/store/cron
- cmd: go test -count=1 github.com/drone/drone/store/logs
- cmd: go test -count=1 github.com/drone/drone/store/perm
@ -114,7 +113,6 @@ tasks:
- cmd: go test -count=1 github.com/drone/drone/store/batch
- cmd: go test -count=1 github.com/drone/drone/store/batch2
- cmd: go test -count=1 github.com/drone/drone/store/build
- cmd: go test -count=1 github.com/drone/drone/store/card
- cmd: go test -count=1 github.com/drone/drone/store/cron
- cmd: go test -count=1 github.com/drone/drone/store/logs
- cmd: go test -count=1 github.com/drone/drone/store/perm

View file

@ -63,7 +63,6 @@ type (
Logging Logging
Prometheus Prometheus
Proxy Proxy
Redis Redis
Registration Registration
Registries Registries
Repository Repository
@ -86,7 +85,6 @@ type (
GitLab GitLab
Gogs Gogs
Stash Stash
Gitee Gitee
}
// Cloning provides the cloning configuration.
@ -113,10 +111,9 @@ type (
// Database provides the database configuration.
Database struct {
Driver string `envconfig:"DRONE_DATABASE_DRIVER" default:"sqlite3"`
Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
Secret string `envconfig:"DRONE_DATABASE_SECRET"`
MaxConnections int `envconfig:"DRONE_DATABASE_MAX_CONNECTIONS" default:"0"`
Driver string `envconfig:"DRONE_DATABASE_DRIVER" default:"sqlite3"`
Datasource string `envconfig:"DRONE_DATABASE_DATASOURCE" default:"core.sqlite"`
Secret string `envconfig:"DRONE_DATABASE_SECRET"`
// Feature flag
LegacyBatch bool `envconfig:"DRONE_DATABASE_LEGACY_BATCH"`
@ -140,14 +137,12 @@ type (
// Jsonnet configures the jsonnet plugin
Jsonnet struct {
Enabled bool `envconfig:"DRONE_JSONNET_ENABLED"`
ImportLimit int `envconfig:"DRONE_JSONNET_IMPORT_LIMIT" default:"0"`
Enabled bool `envconfig:"DRONE_JSONNET_ENABLED"`
}
// Starlark configures the starlark plugin
Starlark struct {
Enabled bool `envconfig:"DRONE_STARLARK_ENABLED"`
StepLimit uint64 `envconfig:"DRONE_STARLARK_STEP_LIMIT"`
Enabled bool `envconfig:"DRONE_STARLARK_ENABLED"`
}
// License provides license configuration
@ -170,14 +165,6 @@ type (
EnableAnonymousAccess bool `envconfig:"DRONE_PROMETHEUS_ANONYMOUS_ACCESS" default:"false"`
}
// Redis provides the redis configuration.
Redis struct {
ConnectionString string `envconfig:"DRONE_REDIS_CONNECTION"`
Addr string `envconfig:"DRONE_REDIS_ADDR"`
Password string `envconfig:"DRONE_REDIS_PASSWORD"`
DB int `envconfig:"DRONE_REDIS_DB"`
}
// Repository provides the repository configuration.
Repository struct {
Filter []string `envconfig:"DRONE_REPOSITORY_FILTER"`
@ -278,9 +265,10 @@ type (
// Session provides the session configuration.
Session struct {
Timeout time.Duration `envconfig:"DRONE_COOKIE_TIMEOUT" default:"720h"`
Secret string `envconfig:"DRONE_COOKIE_SECRET"`
Secure bool `envconfig:"DRONE_COOKIE_SECURE"`
Timeout time.Duration `envconfig:"DRONE_COOKIE_TIMEOUT" default:"720h"`
Secret string `envconfig:"DRONE_COOKIE_SECRET"`
Secure bool `envconfig:"DRONE_COOKIE_SECURE"`
MappingFile string `envconfig:"DRONE_LEGACY_TOKEN_MAPPING_FILE"`
}
// Status provides status configurations.
@ -320,10 +308,6 @@ type (
SkipVerify bool `envconfig:"DRONE_CONVERT_PLUGIN_SKIP_VERIFY"`
CacheSize int `envconfig:"DRONE_CONVERT_PLUGIN_CACHE_SIZE" default:"10"`
Timeout time.Duration `envconfig:"DRONE_CONVERT_TIMEOUT" default:"1m"`
// this flag can be removed once we solve for
// https://github.com/harness/drone/pull/2994#issuecomment-795955312
Multi bool `envconfig:"DRONE_CONVERT_MULTI"`
}
// Validate provides the validation webhook configuration.
@ -368,18 +352,6 @@ type (
Debug bool `envconfig:"DRONE_GITHUB_DEBUG"`
}
// Gitee providers the gitee client configuration.
Gitee struct {
Server string `envconfig:"DRONE_GITEE_SERVER" default:"https://gitee.com"`
APIServer string `envconfig:"DRONE_GITEE_API_SERVER" default:"https://gitee.com/api/v5"`
ClientID string `envconfig:"DRONE_GITEE_CLIENT_ID"`
ClientSecret string `envconfig:"DRONE_GITEE_CLIENT_SECRET"`
RedirectURL string `envconfig:"DRONE_GITEE_REDIRECT_URL"`
SkipVerify bool `envconfig:"DRONE_GITEE_SKIP_VERIFY"`
Scope []string `envconfig:"DRONE_GITEE_SCOPE" default:"user_info,projects,pull_requests,hook"`
Debug bool `envconfig:"DRONE_GITEE_DEBUG"`
}
// GitLab provides the gitlab client configuration.
GitLab struct {
Server string `envconfig:"DRONE_GITLAB_SERVER" default:"https://gitlab.com"`
@ -493,12 +465,6 @@ func (c *Config) IsGitea() bool {
return c.Gitea.Server != ""
}
// IsGitee returns true if the Gitee integration
// is activated.
func (c *Config) IsGitee() bool {
return c.Gitee.ClientID != ""
}
// IsBitbucket returns true if the Bitbucket Cloud
// integration is activated.
func (c *Config) IsBitbucket() bool {
@ -511,28 +477,17 @@ func (c *Config) IsStash() bool {
return c.Stash.Server != ""
}
func cleanHostname(hostname string) string {
hostname = strings.ToLower(hostname)
hostname = strings.TrimPrefix(hostname, "http://")
hostname = strings.TrimPrefix(hostname, "https://")
return hostname
}
func defaultAddress(c *Config) {
if c.Server.Key != "" || c.Server.Cert != "" || c.Server.Acme {
c.Server.Port = ":443"
c.Server.Proto = "https"
}
c.Server.Host = cleanHostname(c.Server.Host)
c.Server.Addr = c.Server.Proto + "://" + c.Server.Host
}
func defaultProxy(c *Config) {
if c.Proxy.Host == "" {
c.Proxy.Host = c.Server.Host
} else {
c.Proxy.Host = cleanHostname(c.Proxy.Host)
}
if c.Proxy.Proto == "" {
c.Proxy.Proto = c.Server.Proto

View file

@ -1,48 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import "testing"
func Test_cleanHostname(t *testing.T) {
tests := []struct {
name string
hostname string
want string
}{
{
name: "no prefix",
hostname: "drone.io",
want: "drone.io",
},
{
name: "http prefix",
hostname: "http://drone.io",
want: "drone.io",
},
{
name: "https prefix",
hostname: "https://drone.io",
want: "drone.io",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := cleanHostname(tt.hostname); got != tt.want {
t.Errorf("cleanHostname() = %v, want %v", got, tt.want)
}
})
}
}

View file

@ -28,7 +28,6 @@ import (
"github.com/drone/go-scm/scm"
"github.com/drone/go-scm/scm/driver/bitbucket"
"github.com/drone/go-scm/scm/driver/gitea"
"github.com/drone/go-scm/scm/driver/gitee"
"github.com/drone/go-scm/scm/driver/github"
"github.com/drone/go-scm/scm/driver/gitlab"
"github.com/drone/go-scm/scm/driver/gogs"
@ -54,8 +53,6 @@ func provideClient(config config.Config) *scm.Client {
return provideBitbucketClient(config)
case config.Github.ClientID != "":
return provideGithubClient(config)
case config.Gitee.ClientID != "":
return provideGiteeClient(config)
case config.Gitea.Server != "":
return provideGiteaClient(config)
case config.GitLab.ClientID != "":
@ -110,32 +107,6 @@ func provideGithubClient(config config.Config) *scm.Client {
return client
}
// provideGiteeClient is a Wire provider function that returns
// a Gitee client based on the environment configuration.
func provideGiteeClient(config config.Config) *scm.Client {
client, err := gitee.New(config.Gitee.APIServer)
if err != nil {
logrus.WithError(err).
Fatalln("main: cannot create the Gitee client")
}
if config.Gitee.Debug {
client.DumpResponse = httputil.DumpResponse
}
client.Client = &http.Client{
Transport: &oauth2.Transport{
Scheme: oauth2.SchemeBearer,
Source: &oauth2.Refresher{
ClientID: config.Gitee.ClientID,
ClientSecret: config.Gitee.ClientSecret,
Endpoint: strings.TrimSuffix(config.Gitee.Server, "/") + "/oauth/token",
Source: oauth2.ContextTokenSource(),
},
Base: defaultTransport(config.Gitee.SkipVerify),
},
}
return client
}
// provideGiteaClient is a Wire provider function that returns
// a Gitea client based on the environment configuration.
func provideGiteaClient(config config.Config) *scm.Client {
@ -180,13 +151,7 @@ func provideGitlabClient(config config.Config) *scm.Client {
}
client.Client = &http.Client{
Transport: &oauth2.Transport{
Scheme: oauth2.SchemeBearer,
Source: &oauth2.Refresher{
ClientID: config.GitLab.ClientID,
ClientSecret: config.GitLab.ClientSecret,
Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
Source: oauth2.ContextTokenSource(),
},
Source: oauth2.ContextTokenSource(),
Base: defaultTransport(config.GitLab.SkipVerify),
},
}

View file

@ -1,31 +0,0 @@
// Copyright 2021 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"github.com/drone/drone/cmd/drone-server/config"
"github.com/drone/drone/service/redisdb"
"github.com/google/wire"
)
// wire set for loading the external services.
var externalSet = wire.NewSet(
provideRedisClient,
)
func provideRedisClient(config config.Config) (rdb redisdb.RedisDB, err error) {
return redisdb.New(config)
}

View file

@ -19,7 +19,6 @@ import (
"github.com/drone/go-login/login"
"github.com/drone/go-login/login/bitbucket"
"github.com/drone/go-login/login/gitea"
"github.com/drone/go-login/login/gitee"
"github.com/drone/go-login/login/github"
"github.com/drone/go-login/login/gitlab"
"github.com/drone/go-login/login/gogs"
@ -45,8 +44,6 @@ func provideLogin(config config.Config) login.Middleware {
return provideBitbucketLogin(config)
case config.Github.ClientID != "":
return provideGithubLogin(config)
case config.Gitee.ClientID != "":
return provideGiteeLogin(config)
case config.Gitea.Server != "":
return provideGiteaLogin(config)
case config.GitLab.ClientID != "":
@ -90,33 +87,13 @@ func provideGithubLogin(config config.Config) login.Middleware {
}
}
// provideGiteeLogin is a Wire provider function that returns
// a Gitee authenticator based on the environment configuration.
func provideGiteeLogin(config config.Config) login.Middleware {
if config.Gitee.ClientID == "" {
return nil
}
redirectURL := config.Gitee.RedirectURL
if redirectURL == "" {
redirectURL = config.Server.Addr + "/login"
}
return &gitee.Config{
ClientID: config.Gitee.ClientID,
ClientSecret: config.Gitee.ClientSecret,
RedirectURL: redirectURL,
Server: config.Gitee.Server,
Scope: config.Gitee.Scope,
Client: defaultClient(config.Gitee.SkipVerify),
}
}
// provideGiteaLogin is a Wire provider function that returns
// a Gitea authenticator based on the environment configuration.
func provideGiteaLogin(config config.Config) login.Middleware {
if config.Gitea.Server == "" {
return nil
}
return &gitea.Config{
return &gitea.Config {
ClientID: config.Gitea.ClientID,
ClientSecret: config.Gitea.ClientSecret,
Server: config.Gitea.Server,
@ -197,23 +174,6 @@ func provideRefresher(config config.Config) *oauth2.Refresher {
Source: oauth2.ContextTokenSource(),
Client: defaultClient(config.Gitea.SkipVerify),
}
case config.GitLab.ClientID != "":
return &oauth2.Refresher{
ClientID: config.GitLab.ClientID,
ClientSecret: config.GitLab.ClientSecret,
Endpoint: strings.TrimSuffix(config.GitLab.Server, "/") + "/oauth/token",
Source: oauth2.ContextTokenSource(),
Client: defaultClient(config.GitLab.SkipVerify),
}
case config.Gitee.ClientID != "":
return &oauth2.Refresher{
ClientID: config.Gitee.ClientID,
ClientSecret: config.Gitee.ClientSecret,
Endpoint: strings.TrimSuffix(config.Gitee.Server, "/") + "/oauth/token",
Source: oauth2.ContextTokenSource(),
Client: defaultClient(config.Gitee.SkipVerify),
}
}
return nil
}

View file

@ -76,22 +76,17 @@ func provideConfigPlugin(client *scm.Client, contents core.FileService, conf spe
// provideConvertPlugin is a Wire provider function that returns
// a yaml conversion plugin based on the environment
// configuration.
func provideConvertPlugin(client *scm.Client, fileService core.FileService, conf spec.Config, templateStore core.TemplateStore) core.ConvertService {
func provideConvertPlugin(client *scm.Client, conf spec.Config, templateStore core.TemplateStore) core.ConvertService {
return converter.Combine(
conf.Convert.Multi,
converter.Legacy(false),
converter.Starlark(
conf.Starlark.Enabled,
conf.Starlark.StepLimit,
),
converter.Jsonnet(
conf.Jsonnet.Enabled,
conf.Jsonnet.ImportLimit,
fileService,
),
converter.Template(
templateStore,
conf.Starlark.StepLimit,
),
converter.Memoize(
converter.Remote(

View file

@ -15,9 +15,9 @@
package main
import (
"github.com/drone/drone/cmd/drone-server/config"
"github.com/drone/drone/core"
"github.com/drone/drone/scheduler/queue"
"github.com/drone/drone/service/redisdb"
"github.com/google/wire"
)
@ -29,6 +29,6 @@ var schedulerSet = wire.NewSet(
// provideScheduler is a Wire provider function that returns a
// scheduler based on the environment configuration.
func provideScheduler(store core.StageStore, r redisdb.RedisDB) core.Scheduler {
return queue.New(store, r)
func provideScheduler(store core.StageStore, config config.Config) core.Scheduler {
return queue.New(store)
}

View file

@ -120,6 +120,15 @@ func provideRepositoryService(client *scm.Client, renewer core.Renewer, config c
// provideSession is a Wire provider function that returns a
// user session based on the environment configuration.
func provideSession(store core.UserStore, config config.Config) (core.Session, error) {
if config.Session.MappingFile != "" {
return session.Legacy(store, session.Config{
Secure: config.Session.Secure,
Secret: config.Session.Secret,
Timeout: config.Session.Timeout,
MappingFile: config.Session.MappingFile,
})
}
return session.New(store, session.NewConfig(
config.Session.Secret,
config.Session.Timeout,
@ -212,7 +221,6 @@ func provideDatadog(
EnableStash: config.IsStash(),
EnableGogs: config.IsGogs(),
EnableGitea: config.IsGitea(),
EnableGitee: config.IsGitee(),
EnableAgents: !config.Agent.Disabled,
},
)

View file

@ -21,7 +21,6 @@ import (
"github.com/drone/drone/store/batch"
"github.com/drone/drone/store/batch2"
"github.com/drone/drone/store/build"
"github.com/drone/drone/store/card"
"github.com/drone/drone/store/cron"
"github.com/drone/drone/store/logs"
"github.com/drone/drone/store/perm"
@ -51,7 +50,6 @@ var storeSet = wire.NewSet(
provideBatchStore,
// batch.New,
cron.New,
card.New,
perm.New,
secret.New,
global.New,
@ -65,7 +63,6 @@ func provideDatabase(config config.Config) (*db.DB, error) {
return db.Connect(
config.Database.Driver,
config.Database.Datasource,
config.Database.MaxConnections,
)
}

View file

@ -32,7 +32,6 @@ func InitializeApplication(config config.Config) (application, error) {
serverSet,
serviceSet,
storeSet,
externalSet,
newApplication,
)
return application{}, nil

View file

@ -1,6 +1,6 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate wire
//go:generate go run github.com/google/wire/cmd/wire
//+build !wireinject
package main
@ -20,7 +20,6 @@ import (
"github.com/drone/drone/service/token"
"github.com/drone/drone/service/transfer"
"github.com/drone/drone/service/user"
"github.com/drone/drone/store/card"
"github.com/drone/drone/store/cron"
"github.com/drone/drone/store/perm"
"github.com/drone/drone/store/secret"
@ -56,13 +55,9 @@ func InitializeApplication(config2 config.Config) (application, error) {
cronStore := cron.New(db)
repositoryStore := provideRepoStore(db)
buildStore := provideBuildStore(db)
redisDB, err := provideRedisClient(config2)
if err != nil {
return application{}, err
}
corePubsub := pubsub.New(redisDB)
corePubsub := pubsub.New()
stageStore := provideStageStore(db)
scheduler := provideScheduler(stageStore, redisDB)
scheduler := provideScheduler(stageStore, config2)
statusService := provideStatusService(client, renewer, config2)
stepStore := step.New(db)
system := provideSystem(config2)
@ -71,20 +66,19 @@ func InitializeApplication(config2 config.Config) (application, error) {
fileService := provideContentService(client, renewer)
configService := provideConfigPlugin(client, fileService, config2)
templateStore := template.New(db)
convertService := provideConvertPlugin(client, fileService, config2, templateStore)
convertService := provideConvertPlugin(client, config2, templateStore)
validateService := provideValidatePlugin(config2)
triggerer := trigger.New(coreCanceler, configService, convertService, commitService, statusService, buildStore, scheduler, repositoryStore, userStore, validateService, webhookSender)
cronScheduler := cron2.New(commitService, cronStore, repositoryStore, userStore, triggerer)
reaper := provideReaper(repositoryStore, buildStore, stageStore, coreCanceler, config2)
coreLicense := provideLicense(client, config2)
datadog := provideDatadog(userStore, repositoryStore, buildStore, system, coreLicense, config2)
cardStore := card.New(db)
logStore := provideLogStore(db, config2)
logStream := livelog.New(redisDB)
logStream := livelog.New()
netrcService := provideNetrcService(client, renewer, config2)
secretStore := secret.New(db, encrypter)
globalSecretStore := global.New(db, encrypter)
buildManager := manager.New(buildStore, cardStore, configService, convertService, corePubsub, logStore, logStream, netrcService, repositoryStore, scheduler, secretStore, globalSecretStore, statusService, stageStore, stepStore, system, userStore, webhookSender)
buildManager := manager.New(buildStore, configService, convertService, corePubsub, logStore, logStream, netrcService, repositoryStore, scheduler, secretStore, globalSecretStore, statusService, stageStore, stepStore, system, userStore, webhookSender)
secretService := provideSecretPlugin(config2)
registryService := provideRegistryPlugin(config2)
runner := provideRunner(buildManager, secretService, registryService, config2)
@ -101,7 +95,7 @@ func InitializeApplication(config2 config.Config) (application, error) {
syncer := provideSyncer(repositoryService, repositoryStore, userStore, batcher, config2)
transferer := transfer.New(repositoryStore, permStore)
userService := user.New(client, renewer)
server := api.New(buildStore, commitService, cardStore, cronStore, corePubsub, globalSecretStore, hookService, logStore, coreLicense, licenseService, organizationService, permStore, repositoryStore, repositoryService, scheduler, secretStore, stageStore, stepStore, statusService, session, logStream, syncer, system, templateStore, transferer, triggerer, userStore, userService, webhookSender)
server := api.New(buildStore, commitService, cronStore, corePubsub, globalSecretStore, hookService, logStore, coreLicense, licenseService, organizationService, permStore, repositoryStore, repositoryService, scheduler, secretStore, stageStore, stepStore, statusService, session, logStream, syncer, system, templateStore, transferer, triggerer, userStore, userService, webhookSender)
admissionService := provideAdmissionPlugin(client, organizationService, userService, config2)
hookParser := parser.New(client)
coreLinker := linker.New(client)

View file

@ -77,7 +77,7 @@ type BuildStore interface {
LatestBranches(context.Context, int64) ([]*Build, error)
// LatestPulls returns the latest builds from the
// datastore by pull request.
// datastore by pull requeset.
LatestPulls(context.Context, int64) ([]*Build, error)
// LatestDeploys returns the latest builds from the

View file

@ -1,41 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package core
import (
"context"
"encoding/json"
"io"
)
type CardInput struct {
Schema string `json:"schema"`
Data json.RawMessage `json:"data"`
}
// CardStore manages repository cards.
type CardStore interface {
// Find returns a card data stream from the datastore.
Find(ctx context.Context, step int64) (io.ReadCloser, error)
// Create copies the card stream from Reader r to the datastore.
Create(ctx context.Context, step int64, r io.Reader) error
// Update copies the card stream from Reader r to the datastore.
Update(ctx context.Context, step int64, r io.Reader) error
// Delete purges the card data from the datastore.
Delete(ctx context.Context, step int64) error
}

View file

@ -33,5 +33,5 @@ type Pubsub interface {
Subscribe(context.Context) (<-chan *Message, <-chan error)
// Subscribers returns a count of subscribers.
Subscribers() (int, error)
Subscribers() int
}

View file

@ -32,69 +32,38 @@ const (
type (
// Repository represents a source code repository.
Repository struct {
ID int64 `json:"id"`
UID string `json:"uid"`
UserID int64 `json:"user_id"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Slug string `json:"slug"`
SCM string `json:"scm"`
HTTPURL string `json:"git_http_url"`
SSHURL string `json:"git_ssh_url"`
Link string `json:"link"`
Branch string `json:"default_branch"`
Private bool `json:"private"`
Visibility string `json:"visibility"`
Active bool `json:"active"`
Config string `json:"config_path"`
Trusted bool `json:"trusted"`
Protected bool `json:"protected"`
IgnoreForks bool `json:"ignore_forks"`
IgnorePulls bool `json:"ignore_pull_requests"`
CancelPulls bool `json:"auto_cancel_pull_requests"`
CancelPush bool `json:"auto_cancel_pushes"`
CancelRunning bool `json:"auto_cancel_running"`
Timeout int64 `json:"timeout"`
Throttle int64 `json:"throttle,omitempty"`
Counter int64 `json:"counter"`
Synced int64 `json:"synced"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Version int64 `json:"version"`
Signer string `json:"-"`
Secret string `json:"-"`
Build *Build `json:"build,omitempty"`
Perms *Perm `json:"permissions,omitempty"`
Archived bool `json:"archived"`
}
RepoBuildStage struct {
RepoNamespace string `json:"repo_namespace"`
RepoName string `json:"repo_name"`
RepoSlug string `json:"repo_slug"`
BuildNumber int64 `json:"build_number"`
BuildAuthor string `json:"build_author"`
BuildAuthorName string `json:"build_author_name"`
BuildAuthorEmail string `json:"build_author_email"`
BuildAuthorAvatar string `json:"build_author_avatar"`
BuildSender string `json:"build_sender"`
BuildStarted int64 `json:"build_started"`
BuildFinished int64 `json:"build_finished"`
BuildCreated int64 `json:"build_created"`
BuildUpdated int64 `json:"build_updated"`
StageName string `json:"stage_name"`
StageKind string `json:"stage_kind"`
StageType string `json:"stage_type"`
StageStatus string `json:"stage_status"`
StageMachine string `json:"stage_machine"`
StageOS string `json:"stage_os"`
StageArch string `json:"stage_arch"`
StageVariant string `json:"stage_variant"`
StageKernel string `json:"stage_kernel"`
StageLimit string `json:"stage_limit"`
StageLimitRepo string `json:"stage_limit_repo"`
StageStarted int64 `json:"stage_started"`
StageStopped int64 `json:"stage_stopped"`
ID int64 `json:"id"`
UID string `json:"uid"`
UserID int64 `json:"user_id"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Slug string `json:"slug"`
SCM string `json:"scm"`
HTTPURL string `json:"git_http_url"`
SSHURL string `json:"git_ssh_url"`
Link string `json:"link"`
Branch string `json:"default_branch"`
Private bool `json:"private"`
Visibility string `json:"visibility"`
Active bool `json:"active"`
Config string `json:"config_path"`
Trusted bool `json:"trusted"`
Protected bool `json:"protected"`
IgnoreForks bool `json:"ignore_forks"`
IgnorePulls bool `json:"ignore_pull_requests"`
CancelPulls bool `json:"auto_cancel_pull_requests"`
CancelPush bool `json:"auto_cancel_pushes"`
Timeout int64 `json:"timeout"`
Throttle int64 `json:"throttle,omitempty"`
Counter int64 `json:"counter"`
Synced int64 `json:"synced"`
Created int64 `json:"created"`
Updated int64 `json:"updated"`
Version int64 `json:"version"`
Signer string `json:"-"`
Secret string `json:"-"`
Build *Build `json:"build,omitempty"`
Perms *Perm `json:"permissions,omitempty"`
}
// RepositoryStore defines operations for working with repositories.
@ -114,9 +83,6 @@ type (
// the datastore with incomplete builds.
ListIncomplete(context.Context) ([]*Repository, error)
// ListRunningStatus returns a list of build / repository /stage information for builds that are incomplete.
ListRunningStatus(context.Context) ([]*RepoBuildStage, error)
// ListAll returns a paginated list of all repositories
// stored in the database, including disabled repositories.
ListAll(ctx context.Context, limit, offset int) ([]*Repository, error)

View file

@ -19,21 +19,17 @@ import "context"
type (
// Step represents an individual step in the stage.
Step struct {
ID int64 `json:"id"`
StageID int64 `json:"step_id"` // this is a typo, fixing it has far reaching ramifications. It should only be attempted in a major version change
Number int `json:"number"`
Name string `json:"name"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
ErrIgnore bool `json:"errignore,omitempty"`
ExitCode int `json:"exit_code"`
Started int64 `json:"started,omitempty"`
Stopped int64 `json:"stopped,omitempty"`
Version int64 `json:"version"`
DependsOn []string `json:"depends_on,omitempty"`
Image string `json:"image,omitempty"`
Detached bool `json:"detached,omitempty"`
Schema string `json:"schema,omitempty"`
ID int64 `json:"id"`
StageID int64 `json:"step_id"`
Number int `json:"number"`
Name string `json:"name"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
ErrIgnore bool `json:"errignore,omitempty"`
ExitCode int `json:"exit_code"`
Started int64 `json:"started,omitempty"`
Stopped int64 `json:"stopped,omitempty"`
Version int64 `json:"version"`
}
// StepStore persists build step information to storage.

View file

@ -16,7 +16,7 @@ package core
import "context"
// Transferer handles transferring repository ownership from one
// Transferer handles transfering repository ownership from one
// user to another user account.
type Transferer interface {
Transfer(ctx context.Context, user *User) error

View file

@ -101,7 +101,7 @@ type (
}
)
// Validate validates the user and returns an error if the
// Validate valides the user and returns an error if the
// validation fails.
func (u *User) Validate() error {
switch {

44
go.mod
View file

@ -12,50 +12,64 @@ require (
github.com/coreos/go-semver v0.2.0
github.com/dchest/authcookie v0.0.0-20120917135355-fbdef6e99866
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d
github.com/drone/drone-ui v2.8.2+incompatible
github.com/drone/drone-ui v0.0.0-20210512200715-d96f1e26d448
github.com/drone/drone-yaml v1.2.4-0.20200326192514-6f4d6dfb39e4
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629
github.com/drone/funcmap v0.0.0-20210823160631-9e9dec149056
github.com/drone/go-license v1.0.2
github.com/drone/go-login v1.1.0
github.com/drone/go-scm v1.24.0
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2
github.com/drone/go-scm v1.8.0
github.com/drone/signal v1.0.0
github.com/dustin/go-humanize v1.0.0
github.com/go-chi/chi v3.3.3+incompatible
github.com/go-chi/cors v1.0.0
github.com/go-redis/redis/v8 v8.11.0
github.com/go-redsync/redsync/v4 v4.3.0
github.com/go-ini/ini v1.39.0 // indirect
github.com/go-sql-driver/mysql v1.4.0
github.com/golang/mock v1.3.1
github.com/google/go-cmp v0.5.6
github.com/google/go-jsonnet v0.17.0
github.com/google/go-cmp v0.4.0
github.com/google/go-jsonnet v0.16.0
github.com/google/wire v0.2.1
github.com/gorhill/cronexpr v0.0.0-20140423231348-a557574d6c02 // indirect
github.com/gosimple/slug v1.3.0
github.com/h2non/gock v1.0.15
github.com/hashicorp/go-cleanhttp v0.5.1 // indirect
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/consul/api v1.5.0 // indirect
github.com/hashicorp/go-hclog v0.14.1 // indirect
github.com/hashicorp/go-immutable-radix v1.2.0 // indirect
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/go-multierror v1.0.0
github.com/hashicorp/go-plugin v1.3.0 // indirect
github.com/hashicorp/go-retryablehttp v0.5.4
github.com/hashicorp/go-version v1.2.1 // indirect
github.com/hashicorp/golang-lru v0.5.1
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854
github.com/hashicorp/raft v1.1.2 // indirect
github.com/hashicorp/vault/api v1.0.4 // indirect
github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0
github.com/joho/godotenv v1.3.0
github.com/kelseyhightower/envconfig v1.3.0
github.com/kr/pretty v0.2.0 // indirect
github.com/lib/pq v1.1.0
github.com/mattn/go-sqlite3 v1.9.0
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/hashstructure v1.0.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2
github.com/prometheus/client_golang v0.9.2
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be // indirect
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
github.com/segmentio/ksuid v1.0.2
github.com/sirupsen/logrus v1.6.0
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/ugorji/go v1.1.7 // indirect
github.com/unrolled/secure v0.0.0-20181022170031-4b6b7cf51606
go.starlark.net v0.0.0-20201118183435-e55f603d8c79
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect
gopkg.in/yaml.v2 v2.3.0
golang.org/x/sync v0.0.0-20190423024810-112230192c58
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/yaml.v2 v2.2.8
k8s.io/api v0.0.0-20181130031204-d04500c8c3dd
k8s.io/apimachinery v0.0.0-20181204150028-eb8c8024849b
k8s.io/client-go v10.0.0+incompatible
)
replace github.com/h2non/gock => gopkg.in/h2non/gock.v1 v1.0.14

360
go.sum
View file

@ -25,26 +25,36 @@ github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6L
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Microsoft/go-winio v0.4.11 h1:zoIOcVf0xPN1tnMVbTtEdI+P8OofVk3NObnwOQ6nK2Q=
github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878 h1:EFSB7Zo9Eg91v7MJPVsifUysc/wPdN+NOnVe6bWbdBM=
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f h1:y2hSFdXeA1y5z5f0vfNO0Dg5qVY036qzlz3Pds0B92o=
github.com/asaskevich/govalidator v0.0.0-20180315120708-ccb8e960c48f/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.15.57 h1:inht07/mRNnvV4uAjjVgTVD7/rF+j0mXllYcNQxDgGA=
github.com/aws/aws-sdk-go v1.15.57/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0=
github.com/aws/aws-sdk-go v1.37.3 h1:1f0groABc4AuapskpHf6EBRaG2tqw0Sx3ebCMwfp1Ys=
github.com/aws/aws-sdk-go v1.37.3/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bmatcuk/doublestar v1.1.1 h1:YroD6BJCZBYx06yYFEWvUuKVWQn3vLLQAVmDmvTSaiQ=
github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/buildkite/yaml v2.1.0+incompatible h1:xirI+ql5GzfikVNDmt+yeiXpf/v1Gt03qXTtT5WXdr8=
github.com/buildkite/yaml v2.1.0+incompatible/go.mod h1:UoU8vbcwu1+vjZq01+KrpSeLBgQQIjL/H7Y6KwikUrI=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/codegangsta/negroni v1.0.0 h1:+aYywywx4bnKXWvoWtRfJ91vC59NbEhEY03sZjQhbVY=
@ -62,8 +72,6 @@ github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9 h1:74lLNRzvsdIlkTgfD
github.com/dchest/uniuri v0.0.0-20160212164326-8902c56451e9/go.mod h1:GgB8SF9nRG+GqaDtLcwJZsQFhcogVCJ79j4EdT0c2V4=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/docker/distribution v0.0.0-20170726174610-edc3ab29cdff/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
@ -73,56 +81,90 @@ github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF
github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af h1:I+xfWPZLMaskFvfFO5fEJ6tVI1Q9bWR9tuORZeaCTPo=
github.com/drone/drone-go v1.7.2-0.20220308165842-f9e4fe31c2af/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
github.com/drone/drone-go v1.3.2-0.20200826185551-24929e4d2cfc h1:6AXXCMPilpJqwNqUfG6Zgwakr7HCwnialFiQ/AbqYyQ=
github.com/drone/drone-go v1.3.2-0.20200826185551-24929e4d2cfc/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27 h1:58xKlW/Kwp/Apz+R5qNGzBUIzfq1Z57L7Udz1B6bgWE=
github.com/drone/drone-go v1.4.1-0.20201109202657-b9e58bbbcf27/go.mod h1:fxCf9jAnXDZV1yDr0ckTuWd1intvcQwfJmTRpTZ1mXg=
github.com/drone/drone-runtime v1.0.7-0.20190729202838-87c84080f4a1/go.mod h1:+osgwGADc/nyl40J0fdsf8Z09bgcBZXvXXnLOY48zYs=
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d h1:P5HI/Y9hARTZ3F3EKs0kYijhjXZWQRQHYn1neTi0pWM=
github.com/drone/drone-runtime v1.1.1-0.20200623162453-61e33e2cab5d/go.mod h1:4/2QToW5+HGD0y1sTw7X35W1f7YINS14UfDY4isggT8=
github.com/drone/drone-ui v2.8.2+incompatible h1:7F/MlcSEIZVi5VND/qmOnDDwQOkgqwsCVOQOsGJ2HJc=
github.com/drone/drone-ui v2.8.2+incompatible/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20200701170131-2b91a041998b h1:8VfphhR5arTUOFGf8KpNkEBf2z99kuC/YdnasY75Xus=
github.com/drone/drone-ui v0.0.0-20200701170131-2b91a041998b/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20201110214517-ac1349fcc19c h1:RHVLOVo6vC/p3i64XMQ6lcURQCeqUbg+7vyhCAy8hq0=
github.com/drone/drone-ui v0.0.0-20201110214517-ac1349fcc19c/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318043635-d92124ef8c6b h1:SR3ORKKtSGLA2oGHBr6tP+KaHRB7JSveYreZVxnfQgA=
github.com/drone/drone-ui v0.0.0-20210318043635-d92124ef8c6b/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318051923-d744fdf178d7 h1:KpTwlg8z0xcT7UZXTzK8G0r5+1CeXKkglZwsg6wHuK4=
github.com/drone/drone-ui v0.0.0-20210318051923-d744fdf178d7/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318173335-90cdf440f023 h1:xy7suHSQ4wEuOa8EnCmBpuMEXcfG66QJxY0rdDG9w3c=
github.com/drone/drone-ui v0.0.0-20210318173335-90cdf440f023/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318184040-660cf374c83a h1:b36lw0bXDWRB8miPIA59SUgpV+mTvoUX7otADm8SwyQ=
github.com/drone/drone-ui v0.0.0-20210318184040-660cf374c83a/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318190358-0fd3dd080c5b h1:CfVtYTmPVUm5x2UTUvFF8NtQMYWwlVWz9OiRfxuiLQg=
github.com/drone/drone-ui v0.0.0-20210318190358-0fd3dd080c5b/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210318211453-780e11c45d95 h1:8JsUeiL9slNUbMUYGINI0gi2owD/0JnzKgNrv6EmxHY=
github.com/drone/drone-ui v0.0.0-20210318211453-780e11c45d95/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210319172440-b892bff542b5 h1:6mjZNWxqVKkBt1Pc2ChdMFOzwa8+7oTVX4dTLnEx4dA=
github.com/drone/drone-ui v0.0.0-20210319172440-b892bff542b5/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210322195809-43fc5b050223 h1:lyWHV4jHKzF8kKBrEXjlZDTyuuXuAQ2BabeURGt5hLo=
github.com/drone/drone-ui v0.0.0-20210322195809-43fc5b050223/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210324203842-aaae3627e294 h1:ifbOWfDF/4zNxXW69f4XL06D7aA7cdp5U0moNNh60nw=
github.com/drone/drone-ui v0.0.0-20210324203842-aaae3627e294/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210331233327-772f24b7f519 h1:zEPxQwLA/dI6sQ9htLPWcDT+EKms09w4TSAYk1lOQiA=
github.com/drone/drone-ui v0.0.0-20210331233327-772f24b7f519/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210427231613-96a9f6e17fb7 h1:EUvu5J51N2diuFqLjFTiu65m0EK0TlLD66qDyi43tVE=
github.com/drone/drone-ui v0.0.0-20210427231613-96a9f6e17fb7/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210505020539-1b93fc25c7d8 h1:mIFBOdP8Tif/4li4bmiVjqp6vbxMpTHOuZR80eypm6A=
github.com/drone/drone-ui v0.0.0-20210505020539-1b93fc25c7d8/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-ui v0.0.0-20210512200715-d96f1e26d448 h1:skfTTwMRWSSi3Dv5NrpU8mJn7faccG5q+lqiBQikLiw=
github.com/drone/drone-ui v0.0.0-20210512200715-d96f1e26d448/go.mod h1:NBtVWW7NNJpD9+huMD/5TAE1db2nrEh0i35/9Rf1MPI=
github.com/drone/drone-yaml v1.2.4-0.20200326192514-6f4d6dfb39e4 h1:XsstoCeXC2t8lA9OLTdoFwckaptqahxwjCWsenySfX8=
github.com/drone/drone-yaml v1.2.4-0.20200326192514-6f4d6dfb39e4/go.mod h1:QsqliFK8nG04AHFN9tTn9XJomRBQHD4wcejWW1uz/10=
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629 h1:rIaZZalMGGPb2cU/+ypuggZ8aMlpa17RUlJUtsMv8pw=
github.com/drone/envsubst v1.0.3-0.20200709231038-aa43e1c1a629/go.mod h1:N2jZmlMufstn1KEqvbHjw40h1KyTmnVzHcSc9bFiJ2g=
github.com/drone/funcmap v0.0.0-20210823160631-9e9dec149056 h1:SCJwMR0FMA0aKwAntCBh02YmtHEnU40zaDzeeCvIRug=
github.com/drone/funcmap v0.0.0-20210823160631-9e9dec149056/go.mod h1:Hph0/pT6ZxbujnE1Z6/08p5I0XXuOsppqF6NQlGOK0E=
github.com/drone/go-license v1.0.2 h1:7OwndfYk+Lp/cGHkxe4HUn/Ysrrw3WYH2pnd99yrkok=
github.com/drone/go-license v1.0.2/go.mod h1:fGRHf+F1cEaw3YVYiJ6js3G3dVhcxyS617RnNRUMsms=
github.com/drone/go-login v1.1.0 h1:anQFRh2Z5ketEJ/LvL6SJ6rIwDdfysGXK5bSXkFLInI=
github.com/drone/go-login v1.1.0/go.mod h1:FLxy9vRzLbyBxoCJYxGbG9R0WGn6OyuvBmAtYNt43uw=
github.com/drone/go-scm v1.24.0 h1:wE6bP9gnuyyKJStnl6wl0npt/SBQumjE9jilQAcFy6Q=
github.com/drone/go-scm v1.24.0/go.mod h1:DFIJJjhMj0TSXPz+0ni4nyZ9gtTtC40Vh/TGRugtyWw=
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2 h1:RGpgNkowJc5LAVn/ZONx70qmnaTA0z/3hHPzTBdAEO8=
github.com/drone/go-login v1.0.4-0.20190311170324-2a4df4f242a2/go.mod h1:FLxy9vRzLbyBxoCJYxGbG9R0WGn6OyuvBmAtYNt43uw=
github.com/drone/go-scm v1.7.1-0.20200621203823-3731ec1f1136 h1:RKSqrIGBdttX999GgY7J2n1zIJ3QVXH8coI4ObTBB9E=
github.com/drone/go-scm v1.7.1-0.20200621203823-3731ec1f1136/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.7.2-0.20201015134822-a014bb19b1df h1:CzwzLwv6h9HMJSph4hC9pJzcaPhExUUOf7s3KEu9lRw=
github.com/drone/go-scm v1.7.2-0.20201015134822-a014bb19b1df/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c h1:3Dv6guONE4nry6fvwEvFz/+pnC0tsMudkrz6CwRO3KM=
github.com/drone/go-scm v1.7.2-0.20201028160627-427b8a85897c/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b h1:ivLeFPmHN+9sLMVAF7HvgvEglU5tzoqlzePLY5zKPo8=
github.com/drone/go-scm v1.7.2-0.20201111225713-c0438b46084b/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/go-scm v1.8.0 h1:kDHu38a11loKf6uaBu75TmY1YPwsSaZdseET738Oy0o=
github.com/drone/go-scm v1.8.0/go.mod h1:lXwfbyrIJwFFME5TpzavkwO2T5X8yBK6t6cve7g91x0=
github.com/drone/signal v1.0.0 h1:NrnM2M/4yAuU/tXs6RP1a1ZfxnaHwYkd0kJurA1p6uI=
github.com/drone/signal v1.0.0/go.mod h1:S8t92eFT0g4WUgEc/LxG+LCuiskpMNsG0ajAMGnyZpc=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-chi/chi v3.3.3+incompatible h1:KHkmBEMNkwKuK4FdQL7N2wOeB9jnIx7jR5wsuSBEFI8=
github.com/go-chi/chi v3.3.3+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/cors v1.0.0 h1:e6x8k7uWbUwYs+aXDoiUzeQFT6l0cygBYyNhD7/1Tg0=
github.com/go-chi/cors v1.0.0/go.mod h1:K2Yje0VW/SJzxiyMYu6iPQYa7hMjQX2i/F491VChg1I=
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4=
github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
github.com/go-redis/redis/v8 v8.1.1/go.mod h1:ysgGY09J/QeDYbu3HikWEIPCwaeOkuNoTgKayTEaEOw=
github.com/go-redis/redis/v8 v8.11.0 h1:O1Td0mQ8UFChQ3N9zFQqo6kTU2cJ+/it88gDB+zg0wo=
github.com/go-redis/redis/v8 v8.11.0/go.mod h1:DLomh7y2e3ggQXQLd1YgmvIfecPJoFl7WU5SOQ/r06M=
github.com/go-redsync/redsync/v4 v4.3.0 h1:5cNxbHJc/tr1KX04piPv8nylURyuT3nqjmodkW8JCjM=
github.com/go-redsync/redsync/v4 v4.3.0/go.mod h1:QBOJAs1k8O6Eyrre4a++pxQgHe5eQ+HF56KuTVv+8Bs=
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-ini/ini v1.39.0 h1:/CyW/jTlZLjuzy52jc1XnhJm6IUKEuunpJFpecywNeI=
github.com/go-ini/ini v1.39.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc=
github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506 h1:zDlw+wgyXdfkRuvFCdEDUiPLmZp2cvf/dWHazY0a5VM=
github.com/gogo/protobuf v0.0.0-20170307180453-100ba4e88506/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s=
@ -131,59 +173,119 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/gomodule/redigo v1.8.2 h1:H5XSIre1MB5NbPYFp+i1NBbb5qN1W8Y8YAQoAYbkm8k=
github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0=
github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-jsonnet v0.17.0 h1:/9NIEfhK1NQRKl3sP2536b2+x5HnZMdql7x3yK/l8JY=
github.com/google/go-jsonnet v0.17.0/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw=
github.com/google/go-jsonnet v0.16.0 h1:Nb4EEOp+rdeGGyB1rQ5eisgSAqrTnhf9ip+X6lzZbY0=
github.com/google/go-jsonnet v0.16.0/go.mod h1:sOcuej3UW1vpPTZOr8L7RQimqai1a57bt5j22LzGZCw=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf h1:+RRA9JqSOZFfKrOeqr2z77+8R2RKyh8PG66dcu1V0ck=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/wire v0.2.1 h1:TYj4Z2qjqxa2ufb34UJqVeO9aznL+i0fLO6TqThKZ7Y=
github.com/google/wire v0.2.1/go.mod h1:ptBl5bWD3nzmJHVNwYHV3v4wdtKzBMlU2YbtKQCG9GI=
github.com/googleapis/gnostic v0.2.0 h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=
github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorhill/cronexpr v0.0.0-20140423231348-a557574d6c02 h1:Spo+4PFAGDqULAsZ7J69MOxq4/fwgZ0zvmDTBqpq7yU=
github.com/gorhill/cronexpr v0.0.0-20140423231348-a557574d6c02/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA=
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gosimple/slug v1.3.0 h1:NKQyQMjKkgCpD/Vd+wKtFc7N60bJNCLDubKU/UDKMFI=
github.com/gosimple/slug v1.3.0/go.mod h1:ER78kgg1Mv0NQGlXiDe57DpCyfbNywXXZ9mIorhxAf0=
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f h1:ShTPMJQes6tubcjzGMODIVG5hlrCeImaBnZzKF2N8SM=
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/consul v1.8.4 h1:XaCg97pt9APNhsaPAR6cd31psiWcO+cz+p9SBefnTtM=
github.com/hashicorp/consul/api v1.5.0 h1:Yo2bneoGy68A7aNwmuETFnPhjyBEm7n3vzRacEVMjvI=
github.com/hashicorp/consul/api v1.5.0/go.mod h1:LqwrLNW876eYSuUOo4ZLHBcdKc038txr/IMfbLPATa4=
github.com/hashicorp/consul/sdk v0.5.0 h1:WC4594Wp/LkEeML/OdQKEC1yqBmEYkRp6i7X5u0zDAs=
github.com/hashicorp/consul/sdk v0.5.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI=
github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-hclog v0.14.1 h1:nQcJDQwIAGnmoUWp8ubocEX40cCml/17YkF6csQLReU=
github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.2.0 h1:l6UW37iCXwZkZoAbEYnptSHVE/cQ5bOTPYG5W3vf9+8=
github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=
github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4=
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY=
github.com/hashicorp/go-plugin v1.3.0 h1:4d/wJojzvHV1I4i/rrjVaeuyxWrLzDE1mDCyDy8fXS8=
github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE=
github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.2.1 h1:zEfKbn2+PDgroKdiOzqiE8rsmLqU2uwi5PB5pBJ3TkI=
github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY=
github.com/hashicorp/memberlist v0.2.0 h1:WeeNspppWi5s1OFefTviPQueC/Bq8dONfvNjPhiEQKE=
github.com/hashicorp/memberlist v0.2.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854 h1:L7WhLZt2ory/kQWxqkMwOiBpIoa4BWoadN7yx8LHEtk=
github.com/hashicorp/nomad v0.0.0-20190125003214-134391155854/go.mod h1:WRaKjdO1G2iqi86TvTjIYtKTyxg4pl7NLr9InxtWaI0=
github.com/hashicorp/raft v1.1.2 h1:oxEL5DDeurYxLd3UbcY/hccgSPhLLpiBZ1YxtWEq59c=
github.com/hashicorp/raft v1.1.2/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8=
github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk=
github.com/hashicorp/serf v0.9.0 h1:+Zd/16AJ9lxk9RzfTDyv/TLhZ8UerqYS0/+JGCIDaa0=
github.com/hashicorp/serf v0.9.0/go.mod h1:YL0HO+FifKOW2u1ke99DGVu1zhcpZzNwrLIqBC7vbYU=
github.com/hashicorp/vault/api v1.0.4 h1:j08Or/wryXT4AcHj1oCbMd7IijXcKzYUGw59LGu9onU=
github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q=
github.com/hashicorp/vault/sdk v0.1.13 h1:mOEPeOhT7jl0J4AMl1E705+BcmeRs1VmKNb9F0sMLy8=
github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ=
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE=
github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE=
github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0 h1:5B0uxl2lzNRVkJVg+uGHxWtRt4C0Wjc6kJKo5XYx8xE=
github.com/jmoiron/sqlx v0.0.0-20180614180643-0dae4fefe7c0/go.mod h1:IiEW3SEiiErVyFdH8NTuWjSifiEQKUoyK3LNqr2kCHU=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/json-iterator/go v1.1.5 h1:gL2yXlmiIo4+t+y32d4WGwOjKGYcGOuyrg46vadswDE=
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/kelseyhightower/envconfig v1.3.0 h1:IvRS4f2VcIQy6j4ORGIf9145T/AsUB+oY8LyvN8BXNM=
github.com/kelseyhightower/envconfig v1.3.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
@ -196,17 +298,45 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lib/pq v1.1.0 h1:/5u4a+KGJptBRqGzPvYQL9p0d/tPR4S31+Tnzj9lEO4=
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 h1:HfxbT6/JcvIljmERptWhwa8XzP7H3T+Z2N26gTsaDaA=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4=
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU=
github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y=
github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
@ -214,33 +344,30 @@ github.com/natessilva/dag v0.0.0-20180124060714-7194b8dcc5c4 h1:dnMxwus89s86tI8r
github.com/natessilva/dag v0.0.0-20180124060714-7194b8dcc5c4/go.mod h1:cojhOHk1gbMeklOyDP2oKKLftefXoJreOQGOrXk+Z38=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2 h1:CXwSGu/LYmbjEab5aMCs5usQRVBGThelUKBNnoSOuso=
github.com/oxtoacart/bpool v0.0.0-20150712133111-4e1c5567d7c2/go.mod h1:L3UMQOThbttwfYRNFOWLLVXMhk5Lkio4GGOtw5UrxS0=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c/go.mod h1:HUpKUBZnpzkdx0kD/+Yfuft+uD3zHGtXF/XJB14TUr4=
github.com/peterbourgon/diskv v2.0.1+incompatible h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=
github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU=
github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/prometheus/client_golang v0.9.2 h1:awm861/B8OKDd2I/6o1dy3ra4BamzKhYOiGItCeZ740=
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
@ -254,6 +381,12 @@ github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be h1:ta7tUOvsPHV
github.com/rainycape/unidecode v0.0.0-20150907023854-cb7f23ec59be/go.mod h1:MIDFMn7db1kT65GmV94GzpX9Qdi7N/pQlwb+AN8wh+Q=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967 h1:x7xEyJDP7Hv3LVgvWhzioQqbC/KtuUhTigKlH/8ehhE=
github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/segmentio/ksuid v1.0.2 h1:9yBfKyw4ECGTdALaF09Snw3sLJmYIX6AbPJrAy6MrDc=
github.com/segmentio/ksuid v1.0.2/go.mod h1:BXuJDr2byAiHuQaQtSKoXh1J0YmUDurywOXgB2w+OSU=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
@ -261,28 +394,34 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM=
github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/unrolled/secure v0.0.0-20181022170031-4b6b7cf51606 h1:dU9yXzNi9rl6Mou7+3npdfPyeFPb2+7BHs3zL47bhPY=
github.com/unrolled/secure v0.0.0-20181022170031-4b6b7cf51606/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA=
github.com/vinzenz/yaml v0.0.0-20170920082545-91409cdd725d h1:3wDi6J5APMqaHBVPuVd7RmHD2gRTfqbdcVSpCNoUWtk=
github.com/vinzenz/yaml v0.0.0-20170920082545-91409cdd725d/go.mod h1:mb5taDqMnJiZNRQ3+02W2IFG+oEz1+dTuCXkp4jpkfo=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0=
go.starlark.net v0.0.0-20201118183435-e55f603d8c79 h1:JPjLPz44y2N9mkzh2N344kTk1Y4/V4yJAjTrXGmzv8I=
go.starlark.net v0.0.0-20201118183435-e55f603d8c79/go.mod h1:5YFcFnRptTN+41758c2bMPiqpGg4zBfYji1IQz8wNFk=
golang.org/x/crypto v0.0.0-20180820150726-614d502a4dac/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@ -290,50 +429,55 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 h1:uESlIz09WIHT2I+pasSXcpLYqYK8wHcdCetU3VuMBJE=
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181005133103-4497e2df6f9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 h1:1/DFK4b7JH8DmkqhUk48onnSfrPzImPoVxuomtbT2nk=
golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@ -345,60 +489,64 @@ golang.org/x/tools v0.0.0-20181017214349-06f26fdaaa28/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE=
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/h2non/gock.v1 v1.0.14 h1:fTeu9fcUvSnLNacYvYI54h+1/XEteDyHvrVCZEEEYNM=
gopkg.in/h2non/gock.v1 v1.0.14/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww=
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4=
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20181130031204-d04500c8c3dd h1:5aHsneN62ehs/tdtS9tWZlhVk68V7yms/Qw7nsGmvCA=
k8s.io/api v0.0.0-20181130031204-d04500c8c3dd/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA=
k8s.io/apimachinery v0.0.0-20181201231028-18a5ff3097b4/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/apimachinery v0.0.0-20181204150028-eb8c8024849b h1:NBYMVxACHvRjnsH8rkNm2ICFZlXznkXYEefUdEpcueY=
k8s.io/apimachinery v0.0.0-20181204150028-eb8c8024849b/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0=
k8s.io/client-go v9.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/client-go v10.0.0+incompatible h1:F1IqCqw7oMBzDkqlcBymRq1450wD0eNqLE9jzUrIi34=
k8s.io/client-go v10.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s=
k8s.io/klog v0.1.0 h1:I5HMfc/DtuVaGR1KPwUrTc476K8NCqNBldC7H4dYEzk=
k8s.io/klog v0.1.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
sigs.k8s.io/yaml v1.1.0 h1:4A07+ZFc2wgJwo8YNlQpr1rVlgUDlxXHhPJciaPY5gs=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=

View file

@ -51,14 +51,9 @@ func CheckMembership(service core.OrganizationService, admin bool) func(http.Han
return
}
if user.Login == namespace {
next.ServeHTTP(w, r)
return
}
isMember, isAdmin, err := service.Membership(ctx, user, namespace)
if err != nil {
render.Unauthorized(w, errors.ErrForbidden)
render.Unauthorized(w, errors.ErrNotFound)
log.Debugln("api: organization membership not found")
return
}
@ -68,13 +63,13 @@ func CheckMembership(service core.OrganizationService, admin bool) func(http.Han
WithField("organization.admin", isAdmin)
if isMember == false {
render.Unauthorized(w, errors.ErrForbidden)
render.Unauthorized(w, errors.ErrNotFound)
log.Debugln("api: organization membership is required")
return
}
if isAdmin == false && admin == true {
render.Unauthorized(w, errors.ErrForbidden)
render.Unauthorized(w, errors.ErrNotFound)
log.Debugln("api: organization administrator is required")
return
}

View file

@ -23,7 +23,6 @@ import (
"github.com/drone/drone/handler/api/auth"
"github.com/drone/drone/handler/api/badge"
globalbuilds "github.com/drone/drone/handler/api/builds"
"github.com/drone/drone/handler/api/card"
"github.com/drone/drone/handler/api/ccmenu"
"github.com/drone/drone/handler/api/events"
"github.com/drone/drone/handler/api/queue"
@ -64,7 +63,6 @@ var corsOpts = cors.Options{
func New(
builds core.BuildStore,
commits core.CommitService,
card core.CardStore,
cron core.CronStore,
events core.Pubsub,
globals core.GlobalSecretStore,
@ -94,7 +92,6 @@ func New(
) Server {
return Server{
Builds: builds,
Card: card,
Cron: cron,
Commits: commits,
Events: events,
@ -128,7 +125,6 @@ func New(
// Server is a http.Handler which exposes drone functionality over HTTP.
type Server struct {
Builds core.BuildStore
Card core.CardStore
Cron core.CronStore
Commits core.CommitService
Events core.Pubsub
@ -289,16 +285,6 @@ func (s Server) Handler() http.Handler {
acl.CheckAdminAccess(),
).Delete("/{member}", collabs.HandleDelete(s.Users, s.Repos, s.Perms))
})
r.Route("/cards", func(r chi.Router) {
r.Get("/{build}/{stage}/{step}", card.HandleFind(s.Builds, s.Card, s.Stages, s.Steps, s.Repos))
r.With(
acl.CheckAdminAccess(),
).Post("/{build}/{stage}/{step}", card.HandleCreate(s.Builds, s.Card, s.Stages, s.Steps, s.Repos))
r.With(
acl.CheckAdminAccess(),
).Delete("/{build}/{stage}/{step}", card.HandleDelete(s.Builds, s.Card, s.Stages, s.Steps, s.Repos))
})
})
})
@ -359,7 +345,6 @@ func (s Server) Handler() http.Handler {
r.Route("/builds", func(r chi.Router) {
r.Use(acl.AuthorizeAdmin)
r.Get("/incomplete", globalbuilds.HandleIncomplete(s.Repos))
r.Get("/incomplete/v2", globalbuilds.HandleRunningStatus(s.Repos))
})
r.Route("/secrets", func(r chi.Router) {
@ -374,7 +359,7 @@ func (s Server) Handler() http.Handler {
r.Route("/templates", func(r chi.Router) {
r.With(acl.CheckMembership(s.Orgs, false)).Get("/", template.HandleListAll(s.Template))
r.With(acl.CheckMembership(s.Orgs, true)).Post("/{namespace}", template.HandleCreate(s.Template))
r.With(acl.CheckMembership(s.Orgs, true)).Post("/", template.HandleCreate(s.Template))
r.With(acl.CheckMembership(s.Orgs, false)).Get("/{namespace}", template.HandleList(s.Template))
r.With(acl.CheckMembership(s.Orgs, false)).Get("/{namespace}/{name}", template.HandleFind(s.Template))
r.With(acl.CheckMembership(s.Orgs, true)).Put("/{namespace}/{name}", template.HandleUpdate(s.Template))

View file

@ -28,16 +28,3 @@ func HandleIncomplete(repos core.RepositoryStore) http.HandlerFunc {
}
}
}
func HandleRunningStatus(repos core.RepositoryStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
list, err := repos.ListRunningStatus(r.Context())
if err != nil {
render.InternalError(w, err)
logger.FromRequest(r).WithError(err).
Debugln("api: cannot list incomplete builds")
} else {
render.JSON(w, list, 200)
}
}
}

View file

@ -31,7 +31,3 @@ var notImplemented = func(w http.ResponseWriter, r *http.Request) {
func HandleIncomplete(repos core.RepositoryStore) http.HandlerFunc {
return notImplemented
}
func HandleRunningStatus(repos core.RepositoryStore) http.HandlerFunc {
return notImplemented
}

View file

@ -1,103 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"bytes"
"encoding/json"
"io/ioutil"
"net/http"
"strconv"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
"github.com/go-chi/chi"
)
// HandleCreate returns an http.HandlerFunc that processes http
// requests to create a new card.
func HandleCreate(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
namespace = chi.URLParam(r, "owner")
name = chi.URLParam(r, "name")
)
buildNumber, err := strconv.ParseInt(chi.URLParam(r, "build"), 10, 64)
if err != nil {
render.BadRequest(w, err)
return
}
stageNumber, err := strconv.Atoi(chi.URLParam(r, "stage"))
if err != nil {
render.BadRequest(w, err)
return
}
stepNumber, err := strconv.Atoi(chi.URLParam(r, "step"))
if err != nil {
render.BadRequest(w, err)
return
}
in := new(core.CardInput)
err = json.NewDecoder(r.Body).Decode(in)
if err != nil {
render.BadRequest(w, err)
return
}
repo, err := repoStore.FindName(r.Context(), namespace, name)
if err != nil {
render.NotFound(w, err)
return
}
build, err := buildStore.FindNumber(r.Context(), repo.ID, buildNumber)
if err != nil {
render.NotFound(w, err)
return
}
stage, err := stageStore.FindNumber(r.Context(), build.ID, stageNumber)
if err != nil {
render.NotFound(w, err)
return
}
step, err := stepStore.FindNumber(r.Context(), stage.ID, stepNumber)
if err != nil {
render.NotFound(w, err)
return
}
data := ioutil.NopCloser(
bytes.NewBuffer(in.Data),
)
/// create card
err = cardStore.Create(r.Context(), step.ID, data)
if err != nil {
render.InternalError(w, err)
return
}
// add schema
step.Schema = in.Schema
err = stepStore.Update(r.Context(), step)
if err != nil {
render.InternalError(w, err)
return
}
render.JSON(w, step.ID, 200)
}
}

View file

@ -1,168 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"bytes"
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/mock"
"github.com/go-chi/chi"
"github.com/golang/mock/gomock"
"github.com/google/go-cmp/cmp"
)
type card struct {
Id int64 `json:"id,omitempty"`
Data []byte `json:"card_data"`
}
var (
dummyRepo = &core.Repository{
ID: 1,
UserID: 1,
Slug: "octocat/hello-world",
}
dummyBuild = &core.Build{
ID: 1,
RepoID: 1,
Number: 1,
}
dummyStage = &core.Stage{
ID: 1,
BuildID: 1,
}
dummyStep = &core.Step{
ID: 1,
StageID: 1,
Schema: "https://myschema.com",
}
dummyCard = &card{
Id: dummyStep.ID,
Data: []byte("{\"type\": \"AdaptiveCard\"}"),
}
)
func TestHandleCreate(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
step.EXPECT().Update(gomock.Any(), gomock.Any()).Return(nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Create(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(dummyCard)
w := httptest.NewRecorder()
r := httptest.NewRequest("POST", "/", in)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleCreate(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusOK; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
}
func TestHandleCreate_BadRequest(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
w := httptest.NewRecorder()
r := httptest.NewRequest("POST", "/", nil)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleCreate(nil, nil, nil, nil, nil).ServeHTTP(w, r)
got, want := &errors.Error{}, &errors.Error{Message: "EOF"}
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}
func TestHandleCreate_CreateError(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Create(gomock.Any(), gomock.Any(), gomock.Any()).Return(errors.ErrNotFound)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(dummyCard)
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", in)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleCreate(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusInternalServerError; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := new(errors.Error), errors.ErrNotFound
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}

View file

@ -1,86 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"strconv"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
"net/http"
"github.com/go-chi/chi"
)
// HandleDelete returns an http.HandlerFunc that processes http
// requests to delete a card.
func HandleDelete(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
namespace = chi.URLParam(r, "owner")
name = chi.URLParam(r, "name")
)
buildNumber, err := strconv.ParseInt(chi.URLParam(r, "build"), 10, 64)
if err != nil {
render.BadRequest(w, err)
return
}
stageNumber, err := strconv.Atoi(chi.URLParam(r, "stage"))
if err != nil {
render.BadRequest(w, err)
return
}
stepNumber, err := strconv.Atoi(chi.URLParam(r, "step"))
if err != nil {
render.BadRequest(w, err)
return
}
repo, err := repoStore.FindName(r.Context(), namespace, name)
if err != nil {
render.NotFound(w, err)
return
}
build, err := buildStore.FindNumber(r.Context(), repo.ID, buildNumber)
if err != nil {
render.NotFound(w, err)
return
}
stage, err := stageStore.FindNumber(r.Context(), build.ID, stageNumber)
if err != nil {
render.NotFound(w, err)
return
}
step, err := stepStore.FindNumber(r.Context(), stage.ID, stepNumber)
if err != nil {
render.NotFound(w, err)
return
}
_, err = cardStore.Find(r.Context(), step.ID)
if err != nil {
render.NotFound(w, err)
return
}
err = cardStore.Delete(r.Context(), step.ID)
if err != nil {
render.InternalError(w, err)
return
}
w.WriteHeader(http.StatusNoContent)
}
}

View file

@ -1,156 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"bytes"
"context"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/mock"
"github.com/go-chi/chi"
"github.com/golang/mock/gomock"
"github.com/google/go-cmp/cmp"
)
func TestHandleDelete(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Find(gomock.Any(), dummyStep.ID).Return(ioutil.NopCloser(
bytes.NewBuffer(dummyCard.Data),
), nil)
card.EXPECT().Delete(gomock.Any(), dummyCard.Id).Return(nil)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
w := httptest.NewRecorder()
r := httptest.NewRequest("DELETE", "/", nil)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleDelete(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusNoContent; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
}
func TestHandleDelete_CardNotFound(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Find(gomock.Any(), dummyStep.ID).Return(nil, errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
w := httptest.NewRecorder()
r := httptest.NewRequest("DELETE", "/", nil)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleDelete(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusNotFound; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := new(errors.Error), errors.ErrNotFound
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}
func TestHandleDelete_DeleteError(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Find(gomock.Any(), dummyStep.ID).Return(ioutil.NopCloser(
bytes.NewBuffer(dummyCard.Data),
), nil)
card.EXPECT().Delete(gomock.Any(), dummyCard.Id).Return(errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
w := httptest.NewRecorder()
r := httptest.NewRequest("DELETE", "/", nil)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleDelete(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusInternalServerError; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := new(errors.Error), errors.ErrNotFound
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}

View file

@ -1,82 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"io"
"net/http"
"strconv"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
"github.com/go-chi/chi"
)
// HandleFind returns an http.HandlerFunc that writes a json-encoded
func HandleFind(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
namespace = chi.URLParam(r, "owner")
name = chi.URLParam(r, "name")
)
buildNumber, err := strconv.ParseInt(chi.URLParam(r, "build"), 10, 64)
if err != nil {
render.BadRequest(w, err)
return
}
stageNumber, err := strconv.Atoi(chi.URLParam(r, "stage"))
if err != nil {
render.BadRequest(w, err)
return
}
stepNumber, err := strconv.Atoi(chi.URLParam(r, "step"))
if err != nil {
render.BadRequest(w, err)
return
}
repo, err := repoStore.FindName(r.Context(), namespace, name)
if err != nil {
render.NotFound(w, err)
return
}
build, err := buildStore.FindNumber(r.Context(), repo.ID, buildNumber)
if err != nil {
render.NotFound(w, err)
return
}
stage, err := stageStore.FindNumber(r.Context(), build.ID, stageNumber)
if err != nil {
render.NotFound(w, err)
return
}
step, err := stepStore.FindNumber(r.Context(), stage.ID, stepNumber)
if err != nil {
render.NotFound(w, err)
return
}
cardData, err := cardStore.Find(r.Context(), step.ID)
if err != nil {
render.NotFound(w, err)
return
}
w.Header().Set("Content-Type", "application/json")
io.Copy(w, cardData)
cardData.Close()
}
}

View file

@ -1,114 +0,0 @@
// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package card
import (
"bytes"
"context"
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/mock"
"github.com/go-chi/chi"
"github.com/golang/mock/gomock"
"github.com/google/go-cmp/cmp"
)
func TestHandleFind(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Find(gomock.Any(), dummyStep.ID).Return(ioutil.NopCloser(
bytes.NewBuffer(dummyCard.Data),
), nil)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(dummyCard)
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", in)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleFind(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusOK; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
}
func TestHandleFind_CardNotFound(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(dummyRepo, nil)
build := mock.NewMockBuildStore(controller)
build.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyBuild, nil)
stage := mock.NewMockStageStore(controller)
stage.EXPECT().FindNumber(gomock.Any(), dummyBuild.ID, gomock.Any()).Return(dummyStage, nil)
step := mock.NewMockStepStore(controller)
step.EXPECT().FindNumber(gomock.Any(), dummyStage.ID, gomock.Any()).Return(dummyStep, nil)
card := mock.NewMockCardStore(controller)
card.EXPECT().Find(gomock.Any(), dummyStep.ID).Return(nil, errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
c.URLParams.Add("build", "1")
c.URLParams.Add("stage", "1")
c.URLParams.Add("step", "1")
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(dummyCard)
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", in)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleFind(build, card, stage, step, repos).ServeHTTP(w, r)
if got, want := w.Code, http.StatusNotFound; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := new(errors.Error), errors.ErrNotFound
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}

View file

@ -1,76 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build oss
package card
import (
"net/http"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
)
var notImplemented = func(w http.ResponseWriter, r *http.Request) {
render.NotImplemented(w, render.ErrNotImplemented)
}
func HandleCreate(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return notImplemented
}
func HandleDelete(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return notImplemented
}
func HandleFind(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return notImplemented
}
func HandleFindAll(
buildStore core.BuildStore,
cardStore core.CardStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return notImplemented
}
func HandleFindData(
buildStore core.BuildStore,
cardStore core.CardStore,
stageStore core.StageStore,
stepStore core.StepStore,
repoStore core.RepositoryStore,
) http.HandlerFunc {
return notImplemented
}

View file

@ -82,7 +82,6 @@ func HandleEvents(
events, errc := events.Subscribe(ctx)
logger.Debugln("events: stream opened")
timeoutChan := time.After(24 * time.Hour)
L:
for {
select {
@ -92,7 +91,7 @@ func HandleEvents(
case <-errc:
logger.Debugln("events: stream error")
break L
case <-timeoutChan:
case <-time.After(time.Hour):
logger.Debugln("events: stream timeout")
break L
case <-time.After(pingInterval):

View file

@ -63,7 +63,6 @@ func HandleGlobal(
events, errc := events.Subscribe(ctx)
logger.Debugln("events: stream opened")
timeoutChan := time.After(24 * time.Hour)
L:
for {
select {
@ -73,7 +72,7 @@ func HandleGlobal(
case <-errc:
logger.Debugln("events: stream error")
break L
case <-timeoutChan:
case <-time.After(time.Hour):
logger.Debugln("events: stream timeout")
break L
case <-time.After(pingInterval):

View file

@ -102,7 +102,6 @@ func HandleLogStream(
return
}
timeoutChan := time.After(24 * time.Hour)
L:
for {
select {
@ -110,7 +109,7 @@ func HandleLogStream(
break L
case <-errc:
break L
case <-timeoutChan:
case <-time.After(time.Hour):
break L
case <-time.After(pingInterval):
io.WriteString(w, ": ping\n\n")

View file

@ -37,7 +37,6 @@ func HandleList(
namespace = chi.URLParam(r, "owner")
name = chi.URLParam(r, "name")
branch = r.FormValue("branch")
tag = r.FormValue("tag")
page = r.FormValue("page")
perPage = r.FormValue("per_page")
)
@ -67,9 +66,6 @@ func HandleList(
if branch != "" {
ref := fmt.Sprintf("refs/heads/%s", branch)
results, err = builds.ListRef(r.Context(), repo.ID, ref, limit, offset)
} else if tag != "" {
ref := fmt.Sprintf("refs/tags/%s", tag)
results, err = builds.ListRef(r.Context(), repo.ID, ref, limit, offset)
} else {
results, err = builds.List(r.Context(), repo.ID, limit, offset)
}

View file

@ -139,38 +139,6 @@ func TestListBranch(t *testing.T) {
}
}
func TestListTag(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), gomock.Any(), mockRepo.Name).Return(mockRepo, nil)
builds := mock.NewMockBuildStore(controller)
builds.EXPECT().ListRef(gomock.Any(), mockRepo.ID, "refs/tags/1.33.7", 25, 0).Return(mockBuilds, nil)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/?tag=1.33.7", nil)
r = r.WithContext(
context.WithValue(context.Background(), chi.RouteCtxKey, c),
)
HandleList(repos, builds)(w, r)
if got, want := w.Code, 200; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := []*core.Build{}, mockBuilds
json.NewDecoder(w.Body).Decode(&got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
}
}
func TestList_RepositoryNotFound(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()

View file

@ -64,7 +64,6 @@ func HandleRetry(
}
hook := &core.Hook{
Parent: prev.Number,
Trigger: user.Login,
Event: prev.Event,
Action: prev.Action,

View file

@ -71,7 +71,7 @@ func Handler(repos core.RepositoryStore) http.HandlerFunc {
}
func encrypt(plaintext, key []byte) (ciphertext []byte, err error) {
block, err := aes.NewCipher(key)
block, err := aes.NewCipher(key[:])
if err != nil {
return nil, err
}

View file

@ -28,18 +28,17 @@ import (
type (
repositoryInput struct {
Visibility *string `json:"visibility"`
Config *string `json:"config_path"`
Trusted *bool `json:"trusted"`
Protected *bool `json:"protected"`
IgnoreForks *bool `json:"ignore_forks"`
IgnorePulls *bool `json:"ignore_pull_requests"`
CancelPulls *bool `json:"auto_cancel_pull_requests"`
CancelPush *bool `json:"auto_cancel_pushes"`
CancelRunning *bool `json:"auto_cancel_running"`
Timeout *int64 `json:"timeout"`
Throttle *int64 `json:"throttle"`
Counter *int64 `json:"counter"`
Visibility *string `json:"visibility"`
Config *string `json:"config_path"`
Trusted *bool `json:"trusted"`
Protected *bool `json:"protected"`
IgnoreForks *bool `json:"ignore_forks"`
IgnorePulls *bool `json:"ignore_pull_requests"`
CancelPulls *bool `json:"auto_cancel_pull_requests"`
CancelPush *bool `json:"auto_cancel_pushes"`
Timeout *int64 `json:"timeout"`
Throttle *int64 `json:"throttle"`
Counter *int64 `json:"counter"`
}
)
@ -96,9 +95,6 @@ func HandleUpdate(repos core.RepositoryStore) http.HandlerFunc {
if in.CancelPush != nil {
repo.CancelPush = *in.CancelPush
}
if in.CancelRunning != nil {
repo.CancelRunning = *in.CancelRunning
}
//
// system administrator only

View file

@ -12,9 +12,9 @@ import (
"strings"
"testing"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/mock"
"github.com/drone/drone/core"
"github.com/go-chi/chi"
"github.com/golang/mock/gomock"
@ -220,76 +220,3 @@ func TestUpdate_UpdateFailed(t *testing.T) {
t.Errorf(diff)
}
}
func TestUpdateAutoCancelRunning(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
repo := &core.Repository{
ID: 1,
UserID: 1,
Namespace: "octocat",
Name: "hello-world",
Slug: "octocat/hello-world",
Branch: "master",
Private: false,
Visibility: core.VisibilityPrivate,
HTTPURL: "https://github.com/octocat/hello-world.git",
SSHURL: "git@github.com:octocat/hello-world.git",
Link: "https://github.com/octocat/hello-world",
CancelRunning: false,
}
repoInput := &core.Repository{
CancelRunning: true,
Visibility: core.VisibilityPrivate,
}
shouldBeValue := true
checkUpdate := func(_ context.Context, updated *core.Repository) error {
if got, want := updated.CancelRunning, shouldBeValue; got != want {
t.Errorf("Want repository visibility updated to %v, got %v", want, got)
}
return nil
}
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().FindName(gomock.Any(), "octocat", "hello-world").Return(repo, nil)
repos.EXPECT().Update(gomock.Any(), repo).Return(nil).Do(checkUpdate)
c := new(chi.Context)
c.URLParams.Add("owner", "octocat")
c.URLParams.Add("name", "hello-world")
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(repoInput)
w := httptest.NewRecorder()
r := httptest.NewRequest("POST", "/", in)
r = r.WithContext(
context.WithValue(r.Context(), chi.RouteCtxKey, c),
)
HandleUpdate(repos)(w, r)
if got, want := w.Code, 200; want != got {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := new(core.Repository), &core.Repository{
ID: 1,
UserID: 1,
Namespace: "octocat",
Name: "hello-world",
Slug: "octocat/hello-world",
Branch: "master",
Private: false,
Visibility: core.VisibilityPrivate,
HTTPURL: "https://github.com/octocat/hello-world.git",
SSHURL: "git@github.com:octocat/hello-world.git",
Link: "https://github.com/octocat/hello-world",
CancelRunning: true,
}
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) > 0 {
t.Errorf(diff)
}
}

View file

@ -145,13 +145,7 @@ func HandleStats(
// Event Stats
//
stats.Events.Subscribers, err = bus.Subscribers()
if err != nil {
render.InternalError(w, err)
logger.FromRequest(r).WithError(err).
Warnln("stats: cannot get number of subscribers")
return
}
stats.Events.Subscribers = bus.Subscribers()
//
// Stream Stats

View file

@ -24,7 +24,7 @@ import (
var (
dummyTemplate = &core.Template{
Name: "my_template.yml",
Name: "my_template",
Data: "my_data",
Created: 1,
Updated: 2,

View file

@ -9,29 +9,21 @@ package template
import (
"encoding/json"
"net/http"
"path/filepath"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/drone/drone/handler/api/render"
"github.com/go-chi/chi"
)
var (
errTemplateExtensionInvalid = errors.New("Template extension invalid. Must be yaml, starlark or jsonnet")
)
type templateInput struct {
Name string `json:"name"`
Data string `json:"data"`
Name string `json:"name"`
Data string `json:"data"`
Namespace string `json:"namespace"`
}
// HandleCreate returns an http.HandlerFunc that processes http
// requests to create a new template.
func HandleCreate(templateStore core.TemplateStore) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
namespace := chi.URLParam(r, "namespace")
in := new(templateInput)
err := json.NewDecoder(r.Body).Decode(in)
if err != nil {
@ -39,20 +31,10 @@ func HandleCreate(templateStore core.TemplateStore) http.HandlerFunc {
return
}
// check valid template extension type
switch filepath.Ext(in.Name) {
case ".yml", ".yaml":
case ".star", ".starlark", ".script":
case ".jsonnet":
default:
render.BadRequest(w, errTemplateExtensionInvalid)
return
}
t := &core.Template{
Name: in.Name,
Data: in.Data,
Namespace: namespace,
Namespace: in.Namespace,
}
err = t.Validate()

View file

@ -48,13 +48,13 @@ func TestHandleCreate(t *testing.T) {
}
}
func TestHandleCreate_NotValidTemplateExtensionName(t *testing.T) {
func TestHandleCreate_ValidationErrorName(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
c := new(chi.Context)
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(&core.Template{Name: "my_template", Data: "my_data"})
json.NewEncoder(in).Encode(&core.Template{Name: "", Data: "my_data"})
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", in)
@ -67,7 +67,7 @@ func TestHandleCreate_NotValidTemplateExtensionName(t *testing.T) {
t.Errorf("Want response code %d, got %d", want, got)
}
got, want := &errors.Error{}, &errors.Error{Message: "Template extension invalid. Must be yaml, starlark or jsonnet"}
got, want := &errors.Error{}, &errors.Error{Message: "No Template Name Provided"}
json.NewDecoder(w.Body).Decode(got)
if diff := cmp.Diff(got, want); len(diff) != 0 {
t.Errorf(diff)
@ -80,7 +80,7 @@ func TestHandleCreate_ValidationErrorData(t *testing.T) {
c := new(chi.Context)
in := new(bytes.Buffer)
json.NewEncoder(in).Encode(&core.Template{Name: "my_template.yml", Data: ""})
json.NewEncoder(in).Encode(&core.Template{Name: "my_template", Data: ""})
w := httptest.NewRecorder()
r := httptest.NewRequest("GET", "/", in)

View file

@ -30,7 +30,7 @@ func TestHandleDelete(t *testing.T) {
template.EXPECT().Delete(gomock.Any(), dummyTemplate).Return(nil)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
w := httptest.NewRecorder()
@ -53,7 +53,7 @@ func TestHandleDelete_TemplateNotFound(t *testing.T) {
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(nil, errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
w := httptest.NewRecorder()
@ -83,7 +83,7 @@ func TestHandleDelete_DeleteError(t *testing.T) {
template.EXPECT().Delete(gomock.Any(), dummyTemplate).Return(errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
w := httptest.NewRecorder()

View file

@ -29,7 +29,7 @@ func TestHandleFind(t *testing.T) {
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(dummyTemplate, nil)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
w := httptest.NewRecorder()
@ -52,7 +52,7 @@ func TestHandleFind_TemplateNotFound(t *testing.T) {
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(nil, errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
w := httptest.NewRecorder()

View file

@ -1,56 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build oss
package template
import (
"net/http"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
)
var notImplemented = func(w http.ResponseWriter, r *http.Request) {
render.NotImplemented(w, render.ErrNotImplemented)
}
func HandleCreate(store core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleUpdate(core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleDelete(core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleFind(core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleList(core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleListAll(core.TemplateStore) http.HandlerFunc {
return notImplemented
}
func HandleAll(core.TemplateStore) http.HandlerFunc {
return notImplemented
}

View file

@ -2,8 +2,6 @@
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
// +build !oss
package template
import (

View file

@ -32,7 +32,7 @@ func TestHandleUpdate(t *testing.T) {
template.EXPECT().Update(gomock.Any(), gomock.Any()).Return(nil)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
in := new(bytes.Buffer)
@ -55,10 +55,10 @@ func TestHandleUpdate_ValidationErrorData(t *testing.T) {
defer controller.Finish()
template := mock.NewMockTemplateStore(controller)
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(&core.Template{Name: "my_template.yml"}, nil)
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(&core.Template{Name: "my_template"}, nil)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
in := new(bytes.Buffer)
@ -90,7 +90,7 @@ func TestHandleUpdate_TemplateNotFound(t *testing.T) {
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(nil, errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
in := new(bytes.Buffer)
@ -119,11 +119,11 @@ func TestHandleUpdate_UpdateError(t *testing.T) {
defer controller.Finish()
template := mock.NewMockTemplateStore(controller)
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(&core.Template{Name: "my_template.yml"}, nil)
template.EXPECT().FindName(gomock.Any(), dummyTemplate.Name, dummyTemplate.Namespace).Return(&core.Template{Name: "my_template"}, nil)
template.EXPECT().Update(gomock.Any(), gomock.Any()).Return(errors.ErrNotFound)
c := new(chi.Context)
c.URLParams.Add("name", "my_template.yml")
c.URLParams.Add("name", "my_template")
c.URLParams.Add("namespace", "my_org")
in := new(bytes.Buffer)

View file

@ -25,7 +25,7 @@ func init() {
logrus.SetOutput(ioutil.Discard)
}
func TestRepositoryList(t *testing.T) {
func TestResitoryList(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()
@ -63,7 +63,7 @@ func TestRepositoryList(t *testing.T) {
}
}
func TestRepositoryListErr(t *testing.T) {
func TestResitoryListErr(t *testing.T) {
controller := gomock.NewController(t)
defer controller.Finish()

View file

@ -30,7 +30,7 @@ func HandleSync(syncer core.Syncer, repos core.RepositoryStore) http.HandlerFunc
return func(w http.ResponseWriter, r *http.Request) {
viewer, _ := request.UserFrom(r.Context())
// performs asynchronous account synchronization.
// performs asyncrhonous account synchronization.
// this requires long polling to determine when the
// sync is complete.
if r.FormValue("async") == "true" {
@ -57,7 +57,7 @@ func HandleSync(syncer core.Syncer, repos core.RepositoryStore) http.HandlerFunc
if err != nil {
render.InternalError(w, err)
logger.FromRequest(r).WithError(err).
Warnln("api: cannot synchronize account")
Warnln("api: cannot synchrnoize account")
} else {
render.JSON(w, list, 200)
}

View file

@ -77,7 +77,7 @@ func HandleCreate(users core.UserStore, service core.UserService, sender core.We
if err != nil {
render.ErrorCode(w, err, 400)
logger.FromRequest(r).WithError(err).
Errorln("api: invalid username")
Errorln("api: invlid username")
return
}

View file

@ -30,7 +30,7 @@ func TestCreate(t *testing.T) {
t.Errorf("Want user login %s, got %s", want, got)
}
if in.Hash == "" {
t.Errorf("Expect user secret generated")
t.Errorf("Expect user secert generated")
}
return nil
})

View file

@ -35,7 +35,7 @@ func HandleFind(users core.UserStore) http.HandlerFunc {
if err != nil {
// the client can make a user request by providing
// the user id as opposed to the username. If a
// numeric user id is provided as input, attempt
// numberic user id is provided as input, attempt
// to lookup the user by id.
if id, _ := strconv.ParseInt(login, 10, 64); id != 0 {
user, err = users.Find(r.Context(), id)

View file

@ -150,7 +150,7 @@ func HandleLogin(
}
// If the user account has never been synchronized we
// execute the synchronization logic.
// execute the synchonrization logic.
if time.Unix(user.Synced, 0).Add(syncPeriod).Before(time.Now()) {
user.Syncing = true
}
@ -163,7 +163,7 @@ func HandleLogin(
logger.Errorf("cannot update user: %s", err)
}
// launch the synchronization process in a go-routine,
// launch the synchrnoization process in a go-routine,
// since it is a long-running process and can take up
// to a few minutes.
if user.Syncing {
@ -179,7 +179,7 @@ func HandleLogin(
logger.Debugf("authentication successful")
session.Create(w, user)
http.Redirect(w, r, redirect, http.StatusSeeOther)
http.Redirect(w, r, redirect, 303)
}
}
@ -199,7 +199,7 @@ func synchronize(ctx context.Context, syncer core.Syncer, user *core.User) {
}
func writeLoginError(w http.ResponseWriter, r *http.Request, err error) {
http.Redirect(w, r, "/login/error?message="+err.Error(), http.StatusSeeOther)
http.Redirect(w, r, "/login/error?message="+err.Error(), 303)
}
func writeLoginErrorStr(w http.ResponseWriter, r *http.Request, s string) {

View file

@ -97,7 +97,6 @@ func (s Server) Handler() http.Handler {
r.Use(middleware.Recoverer)
r.Use(middleware.NoCache)
r.Use(logger.Middleware)
r.Use(middleware.StripSlashes)
sec := secure.New(s.Options)
r.Use(sec.Handler)

View file

@ -1,4 +1,4 @@
// Copyright 2021 Drone IO, Inc.
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -12,21 +12,83 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !oss
package livelog
import (
"context"
"errors"
"sync"
"github.com/drone/drone/core"
"github.com/drone/drone/service/redisdb"
)
// New creates a new log streamer. If Redis client passed as parameter is not nil it uses
// a Redis implementation, otherwise it uses an in-memory implementation.
func New(rdb redisdb.RedisDB) core.LogStream {
if rdb != nil {
return newStreamRedis(rdb)
}
// error returned when a stream is not registered with
// the streamer.
var errStreamNotFound = errors.New("stream: not found")
return newStreamer()
type streamer struct {
sync.Mutex
streams map[int64]*stream
}
// New returns a new in-memory log streamer.
func New() core.LogStream {
return &streamer{
streams: make(map[int64]*stream),
}
}
func (s *streamer) Create(ctx context.Context, id int64) error {
s.Lock()
s.streams[id] = newStream()
s.Unlock()
return nil
}
func (s *streamer) Delete(ctx context.Context, id int64) error {
s.Lock()
stream, ok := s.streams[id]
if ok {
delete(s.streams, id)
}
s.Unlock()
if !ok {
return errStreamNotFound
}
return stream.close()
}
func (s *streamer) Write(ctx context.Context, id int64, line *core.Line) error {
s.Lock()
stream, ok := s.streams[id]
s.Unlock()
if !ok {
return errStreamNotFound
}
return stream.write(line)
}
func (s *streamer) Tail(ctx context.Context, id int64) (<-chan *core.Line, <-chan error) {
s.Lock()
stream, ok := s.streams[id]
s.Unlock()
if !ok {
return nil, nil
}
return stream.subscribe(ctx)
}
func (s *streamer) Info(ctx context.Context) *core.LogStreamInfo {
s.Lock()
defer s.Unlock()
info := &core.LogStreamInfo{
Streams: map[int64]int{},
}
for id, stream := range s.streams {
stream.Lock()
info.Streams[id] = len(stream.list)
stream.Unlock()
}
return info
}

View file

@ -1,27 +0,0 @@
// Copyright 2021 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build oss
package livelog
import (
"github.com/drone/drone/core"
"github.com/drone/drone/service/redisdb"
)
// New creates a new in-memory log streamer.
func New(r redisdb.RedisDB) core.LogStream {
return newStreamer()
}

View file

@ -17,7 +17,7 @@ import (
)
func TestStreamer(t *testing.T) {
s := newStreamer().(*streamer)
s := New().(*streamer)
err := s.Create(context.Background(), 1)
if err != nil {
t.Error(err)
@ -57,7 +57,7 @@ func TestStreamer(t *testing.T) {
}
func TestStreamerDelete(t *testing.T) {
s := newStreamer().(*streamer)
s := New().(*streamer)
err := s.Create(context.Background(), 1)
if err != nil {
t.Error(err)
@ -75,7 +75,7 @@ func TestStreamerDelete(t *testing.T) {
}
func TestStreamerDeleteErr(t *testing.T) {
s := newStreamer()
s := New()
err := s.Delete(context.Background(), 1)
if err != errStreamNotFound {
t.Errorf("Want errStreamNotFound")
@ -83,7 +83,7 @@ func TestStreamerDeleteErr(t *testing.T) {
}
func TestStreamerWriteErr(t *testing.T) {
s := newStreamer()
s := New()
err := s.Write(context.Background(), 1, &core.Line{})
if err != errStreamNotFound {
t.Errorf("Want errStreamNotFound")
@ -91,7 +91,7 @@ func TestStreamerWriteErr(t *testing.T) {
}
func TestStreamTailNotFound(t *testing.T) {
s := newStreamer()
s := New()
outc, errc := s.Tail(context.Background(), 0)
if outc != nil && errc != nil {
t.Errorf("Expect nil channel when stream not found")
@ -99,7 +99,7 @@ func TestStreamTailNotFound(t *testing.T) {
}
func TestStreamerInfo(t *testing.T) {
s := newStreamer().(*streamer)
s := New().(*streamer)
s.streams[1] = &stream{list: map[*subscriber]struct{}{{}: struct{}{}, {}: struct{}{}}}
s.streams[2] = &stream{list: map[*subscriber]struct{}{{}: struct{}{}}}
s.streams[3] = &stream{list: map[*subscriber]struct{}{}}

View file

@ -1,226 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !oss
package livelog
import (
"context"
"encoding/json"
"fmt"
"strconv"
"time"
"github.com/drone/drone/core"
"github.com/drone/drone/service/redisdb"
"github.com/go-redis/redis/v8"
)
func newStreamRedis(r redisdb.RedisDB) core.LogStream {
return streamRedis{
rdb: r,
}
}
const (
redisKeyExpiryTime = 5 * time.Hour // How long each key exists in redis
redisPollTime = 100 * time.Millisecond // should not be too large to avoid redis clients getting occupied for long
redisTailMaxTime = 1 * time.Hour // maximum duration a tail can last
redisEntryKey = "line"
redisStreamPrefix = "drone-log-"
)
type streamRedis struct {
rdb redisdb.RedisDB
}
// Create creates a redis stream and sets an expiry on it.
func (r streamRedis) Create(ctx context.Context, id int64) error {
// Delete if a stream already exists with the same key
_ = r.Delete(ctx, id)
client := r.rdb.Client()
key := redisStreamPrefix + strconv.FormatInt(id, 10)
addResp := client.XAdd(ctx, &redis.XAddArgs{
Stream: key,
ID: "*", // auto-generate a unique incremental ID
MaxLen: bufferSize,
Approx: true,
Values: map[string]interface{}{redisEntryKey: []byte{}},
})
if err := addResp.Err(); err != nil {
return fmt.Errorf("livelog/redis: could not create stream with key %s", key)
}
res := client.Expire(ctx, key, redisKeyExpiryTime)
if err := res.Err(); err != nil {
return fmt.Errorf("livelog/redis: could not set expiry for key %s", key)
}
return nil
}
// Delete deletes a stream
func (r streamRedis) Delete(ctx context.Context, id int64) error {
client := r.rdb.Client()
key := redisStreamPrefix + strconv.FormatInt(id, 10)
if err := r._exists(ctx, key); err != nil {
return err
}
deleteResp := client.Del(ctx, key)
if err := deleteResp.Err(); err != nil {
return fmt.Errorf("livelog/redis: could not delete stream for step %d", id)
}
return nil
}
// Write writes information into the Redis stream
func (r streamRedis) Write(ctx context.Context, id int64, line *core.Line) error {
client := r.rdb.Client()
key := redisStreamPrefix + strconv.FormatInt(id, 10)
if err := r._exists(ctx, key); err != nil {
return err
}
lineJsonData, _ := json.Marshal(line)
addResp := client.XAdd(ctx, &redis.XAddArgs{
Stream: key,
ID: "*", // auto-generate a unique incremental ID
MaxLen: bufferSize,
Approx: true,
Values: map[string]interface{}{redisEntryKey: lineJsonData},
})
if err := addResp.Err(); err != nil {
return err
}
return nil
}
// Tail returns back all the lines in the stream.
func (r streamRedis) Tail(ctx context.Context, id int64) (<-chan *core.Line, <-chan error) {
client := r.rdb.Client()
key := redisStreamPrefix + strconv.FormatInt(id, 10)
if err := r._exists(ctx, key); err != nil {
return nil, nil
}
chLines := make(chan *core.Line, bufferSize)
chErr := make(chan error, 1)
go func() {
defer close(chErr)
defer close(chLines)
timeout := time.After(redisTailMaxTime) // polling should not last for longer than tailMaxTime
// Keep reading from the stream and writing to the channel
lastID := "0"
for {
select {
case <-ctx.Done():
return
case <-timeout:
return
default:
readResp := client.XRead(ctx, &redis.XReadArgs{
Streams: append([]string{key}, lastID),
Block: redisPollTime, // periodically check for ctx.Done
})
if readResp.Err() != nil && readResp.Err() != redis.Nil { // readResp.Err() is sometimes set to "redis: nil" instead of nil
chErr <- readResp.Err()
return
}
for _, msg := range readResp.Val() {
messages := msg.Messages
if len(messages) > 0 {
lastID = messages[len(messages)-1].ID
} else { // should not happen
return
}
for _, message := range messages {
values := message.Values
if val, ok := values[redisEntryKey]; ok {
var line *core.Line
if err := json.Unmarshal([]byte(val.(string)), &line); err != nil {
continue // ignore errors in the stream
}
chLines <- line
}
}
}
}
}
}()
return chLines, chErr
}
// Info returns info about log streams present in redis
func (r streamRedis) Info(ctx context.Context) (info *core.LogStreamInfo) {
client := r.rdb.Client()
info = &core.LogStreamInfo{
Streams: make(map[int64]int),
}
keysResp := client.Keys(ctx, redisStreamPrefix+"*")
if err := keysResp.Err(); err != nil {
return
}
for _, key := range keysResp.Val() {
ids := key[len(redisStreamPrefix):]
id, err := strconv.ParseInt(ids, 10, 64)
if err != nil {
continue
}
lenResp := client.XLen(ctx, key)
if err := lenResp.Err(); err != nil {
continue
}
size := int(lenResp.Val())
info.Streams[id] = size
}
return
}
func (r streamRedis) _exists(ctx context.Context, key string) error {
client := r.rdb.Client()
exists := client.Exists(ctx, key)
if exists.Err() != nil || exists.Val() == 0 {
return fmt.Errorf("livelog/redis: log stream %s not found", key)
}
return nil
}

View file

@ -1,94 +0,0 @@
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package livelog
import (
"context"
"errors"
"sync"
"github.com/drone/drone/core"
)
// error returned when a stream is not registered with
// the streamer.
var errStreamNotFound = errors.New("stream: not found")
type streamer struct {
sync.Mutex
streams map[int64]*stream
}
// New returns a new in-memory log streamer.
func newStreamer() core.LogStream {
return &streamer{
streams: make(map[int64]*stream),
}
}
func (s *streamer) Create(ctx context.Context, id int64) error {
s.Lock()
s.streams[id] = newStream()
s.Unlock()
return nil
}
func (s *streamer) Delete(ctx context.Context, id int64) error {
s.Lock()
stream, ok := s.streams[id]
if ok {
delete(s.streams, id)
}
s.Unlock()
if !ok {
return errStreamNotFound
}
return stream.close()
}
func (s *streamer) Write(ctx context.Context, id int64, line *core.Line) error {
s.Lock()
stream, ok := s.streams[id]
s.Unlock()
if !ok {
return errStreamNotFound
}
return stream.write(line)
}
func (s *streamer) Tail(ctx context.Context, id int64) (<-chan *core.Line, <-chan error) {
s.Lock()
stream, ok := s.streams[id]
s.Unlock()
if !ok {
return nil, nil
}
return stream.subscribe(ctx)
}
func (s *streamer) Info(ctx context.Context) *core.LogStreamInfo {
s.Lock()
defer s.Unlock()
info := &core.LogStreamInfo{
Streams: map[int64]int{},
}
for id, stream := range s.streams {
stream.Lock()
info.Streams[id] = len(stream.list)
stream.Unlock()
}
return info
}

View file

@ -44,9 +44,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
user, _ := s.session.Get(r)
switch {
case !s.anonymous && user == nil:
http.Error(w, errInvalidToken.Error(), http.StatusUnauthorized)
http.Error(w, errInvalidToken.Error(), 401)
case !s.anonymous && !user.Admin && !user.Machine:
http.Error(w, errAccessDenied.Error(), http.StatusForbidden)
http.Error(w, errAccessDenied.Error(), 403)
default:
s.metrics.ServeHTTP(w, r)
}

View file

@ -29,6 +29,5 @@ type Config struct {
EnableStash bool
EnableGogs bool
EnableGitea bool
EnableGitee bool
EnableAgents bool
}

View file

@ -92,7 +92,7 @@ func (d *Datadog) do(ctx context.Context, unix int64) error {
}
userList, _ := d.users.ListRange(ctx, core.UserParams{
Sort: false,
Page: 0,
Page: 1,
Size: 5,
})
tags := createTags(d.config)

View file

@ -39,7 +39,7 @@ func TestDo(t *testing.T) {
users := mock.NewMockUserStore(controller)
users.EXPECT().Count(gomock.Any()).Return(int64(10), nil)
users.EXPECT().ListRange(gomock.Any(), gomock.Any()).Return([]*core.User{{Email: "jane@acme.com", Created: 1257894000}}, nil)
users.EXPECT().ListRange(gomock.Any(), gomock.Any()).Return([]*core.User{{Email: "jane@acme.com"}}, nil)
repos := mock.NewMockRepositoryStore(controller)
repos.EXPECT().Count(gomock.Any()).Return(int64(20), nil)
@ -75,7 +75,7 @@ var sample = `{
"points": [[915148800, 10]],
"type": "gauge",
"host": "test.example.com",
"tags": ["version:` + version.Version.String() + `","remote:github:cloud","scheduler:internal:agents","license:trial","installer:jane@acme.com","installed:2009-11-10T23:00:00Z"]
"tags": ["version:` + version.Version.String() + `","remote:github:cloud","scheduler:internal:agents","license:trial","installer:jane@acme.com"]
},
{
"metric": "drone.repos",

View file

@ -16,7 +16,6 @@ package sink
import (
"fmt"
"time"
"github.com/drone/drone/core"
"github.com/drone/drone/version"
@ -42,8 +41,6 @@ func createTags(config Config) []string {
tags = append(tags, "remote:gogs")
case config.EnableGitea:
tags = append(tags, "remote:gitea")
case config.EnableGitee:
tags = append(tags, "remote:gitee")
default:
tags = append(tags, "remote:undefined")
}
@ -84,9 +81,8 @@ func createInstallerTags(users []*core.User) []string {
if len(user.Email) == 0 {
continue
}
tag1 := fmt.Sprintf("installer:%s", user.Email)
tag2 := fmt.Sprintf("installed:%s", time.Unix(user.Created, 0).UTC().Format(time.RFC3339Nano))
tags = append(tags, tag1, tag2)
tag := fmt.Sprintf("installer:%s", user.Email)
tags = append(tags, tag)
break
}
return tags

View file

@ -6,4 +6,4 @@
package mock
//go:generate mockgen -package=mock -destination=mock_gen.go github.com/drone/drone/core Pubsub,Canceler,ConvertService,ValidateService,NetrcService,Renewer,HookParser,UserService,RepositoryService,CommitService,StatusService,HookService,FileService,Batcher,BuildStore,CronStore,LogStore,PermStore,SecretStore,GlobalSecretStore,StageStore,StepStore,RepositoryStore,UserStore,Scheduler,Session,OrganizationService,SecretService,RegistryService,ConfigService,Transferer,Triggerer,Syncer,LogStream,WebhookSender,LicenseService,TemplateStore,CardStore
//go:generate mockgen -package=mock -destination=mock_gen.go github.com/drone/drone/core Pubsub,Canceler,ConvertService,ValidateService,NetrcService,Renewer,HookParser,UserService,RepositoryService,CommitService,StatusService,HookService,FileService,Batcher,BuildStore,CronStore,LogStore,PermStore,SecretStore,GlobalSecretStore,StageStore,StepStore,RepositoryStore,UserStore,Scheduler,Session,OrganizationService,SecretService,RegistryService,ConfigService,Transferer,Triggerer,Syncer,LogStream,WebhookSender,LicenseService,TemplateStore

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/drone/drone/core (interfaces: Pubsub,Canceler,ConvertService,ValidateService,NetrcService,Renewer,HookParser,UserService,RepositoryService,CommitService,StatusService,HookService,FileService,Batcher,BuildStore,CronStore,LogStore,PermStore,SecretStore,GlobalSecretStore,StageStore,StepStore,RepositoryStore,UserStore,Scheduler,Session,OrganizationService,SecretService,RegistryService,ConfigService,Transferer,Triggerer,Syncer,LogStream,WebhookSender,LicenseService,TemplateStore,CardStore)
// Source: github.com/drone/drone/core (interfaces: Pubsub,Canceler,ConvertService,ValidateService,NetrcService,Renewer,HookParser,UserService,RepositoryService,CommitService,StatusService,HookService,FileService,Batcher,BuildStore,CronStore,LogStore,PermStore,SecretStore,GlobalSecretStore,StageStore,StepStore,RepositoryStore,UserStore,Scheduler,Session,OrganizationService,SecretService,RegistryService,ConfigService,Transferer,Triggerer,Syncer,LogStream,WebhookSender,LicenseService,TemplateStore)
// Package mock is a generated GoMock package.
package mock
@ -67,12 +67,11 @@ func (mr *MockPubsubMockRecorder) Subscribe(arg0 interface{}) *gomock.Call {
}
// Subscribers mocks base method.
func (m *MockPubsub) Subscribers() (int, error) {
func (m *MockPubsub) Subscribers() int {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Subscribers")
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
return ret0
}
// Subscribers indicates an expected call of Subscribers.
@ -1917,21 +1916,6 @@ func (mr *MockRepositoryStoreMockRecorder) ListRecent(arg0, arg1 interface{}) *g
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRecent", reflect.TypeOf((*MockRepositoryStore)(nil).ListRecent), arg0, arg1)
}
// ListRunningStatus mocks base method.
func (m *MockRepositoryStore) ListRunningStatus(arg0 context.Context) ([]*core.RepoBuildStage, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListRunningStatus", arg0)
ret0, _ := ret[0].([]*core.RepoBuildStage)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ListRunningStatus indicates an expected call of ListRunningStatus.
func (mr *MockRepositoryStoreMockRecorder) ListRunningStatus(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRunningStatus", reflect.TypeOf((*MockRepositoryStore)(nil).ListRunningStatus), arg0)
}
// Update mocks base method.
func (m *MockRepositoryStore) Update(arg0 context.Context, arg1 *core.Repository) error {
m.ctrl.T.Helper()
@ -2894,83 +2878,3 @@ func (mr *MockTemplateStoreMockRecorder) Update(arg0, arg1 interface{}) *gomock.
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockTemplateStore)(nil).Update), arg0, arg1)
}
// MockCardStore is a mock of CardStore interface.
type MockCardStore struct {
ctrl *gomock.Controller
recorder *MockCardStoreMockRecorder
}
// MockCardStoreMockRecorder is the mock recorder for MockCardStore.
type MockCardStoreMockRecorder struct {
mock *MockCardStore
}
// NewMockCardStore creates a new mock instance.
func NewMockCardStore(ctrl *gomock.Controller) *MockCardStore {
mock := &MockCardStore{ctrl: ctrl}
mock.recorder = &MockCardStoreMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockCardStore) EXPECT() *MockCardStoreMockRecorder {
return m.recorder
}
// Create mocks base method.
func (m *MockCardStore) Create(arg0 context.Context, arg1 int64, arg2 io.Reader) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// Create indicates an expected call of Create.
func (mr *MockCardStoreMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockCardStore)(nil).Create), arg0, arg1, arg2)
}
// Delete mocks base method.
func (m *MockCardStore) Delete(arg0 context.Context, arg1 int64) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delete", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// Delete indicates an expected call of Delete.
func (mr *MockCardStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockCardStore)(nil).Delete), arg0, arg1)
}
// Find mocks base method.
func (m *MockCardStore) Find(arg0 context.Context, arg1 int64) (io.ReadCloser, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0, arg1)
ret0, _ := ret[0].(io.ReadCloser)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Find indicates an expected call of Find.
func (mr *MockCardStoreMockRecorder) Find(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockCardStore)(nil).Find), arg0, arg1)
}
// Update mocks base method.
func (m *MockCardStore) Update(arg0 context.Context, arg1 int64, arg2 io.Reader) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Update", arg0, arg1, arg2)
ret0, _ := ret[0].(error)
return ret0
}
// Update indicates an expected call of Update.
func (mr *MockCardStoreMockRecorder) Update(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockCardStore)(nil).Update), arg0, arg1, arg2)
}

View file

@ -6,36 +6,35 @@ package mockscm
import (
context "context"
reflect "reflect"
scm "github.com/drone/go-scm/scm"
gomock "github.com/golang/mock/gomock"
reflect "reflect"
)
// MockContentService is a mock of ContentService interface.
// MockContentService is a mock of ContentService interface
type MockContentService struct {
ctrl *gomock.Controller
recorder *MockContentServiceMockRecorder
}
// MockContentServiceMockRecorder is the mock recorder for MockContentService.
// MockContentServiceMockRecorder is the mock recorder for MockContentService
type MockContentServiceMockRecorder struct {
mock *MockContentService
}
// NewMockContentService creates a new mock instance.
// NewMockContentService creates a new mock instance
func NewMockContentService(ctrl *gomock.Controller) *MockContentService {
mock := &MockContentService{ctrl: ctrl}
mock.recorder = &MockContentServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockContentService) EXPECT() *MockContentServiceMockRecorder {
return m.recorder
}
// Create mocks base method.
// Create mocks base method
func (m *MockContentService) Create(arg0 context.Context, arg1, arg2 string, arg3 *scm.ContentParams) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2, arg3)
@ -44,14 +43,14 @@ func (m *MockContentService) Create(arg0 context.Context, arg1, arg2 string, arg
return ret0, ret1
}
// Create indicates an expected call of Create.
// Create indicates an expected call of Create
func (mr *MockContentServiceMockRecorder) Create(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockContentService)(nil).Create), arg0, arg1, arg2, arg3)
}
// Delete mocks base method.
func (m *MockContentService) Delete(arg0 context.Context, arg1, arg2 string, arg3 *scm.ContentParams) (*scm.Response, error) {
// Delete mocks base method
func (m *MockContentService) Delete(arg0 context.Context, arg1, arg2, arg3 string) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(*scm.Response)
@ -59,13 +58,13 @@ func (m *MockContentService) Delete(arg0 context.Context, arg1, arg2 string, arg
return ret0, ret1
}
// Delete indicates an expected call of Delete.
// Delete indicates an expected call of Delete
func (mr *MockContentServiceMockRecorder) Delete(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockContentService)(nil).Delete), arg0, arg1, arg2, arg3)
}
// Find mocks base method.
// Find mocks base method
func (m *MockContentService) Find(arg0 context.Context, arg1, arg2, arg3 string) (*scm.Content, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0, arg1, arg2, arg3)
@ -75,13 +74,13 @@ func (m *MockContentService) Find(arg0 context.Context, arg1, arg2, arg3 string)
return ret0, ret1, ret2
}
// Find indicates an expected call of Find.
// Find indicates an expected call of Find
func (mr *MockContentServiceMockRecorder) Find(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockContentService)(nil).Find), arg0, arg1, arg2, arg3)
}
// List mocks base method.
// List mocks base method
func (m *MockContentService) List(arg0 context.Context, arg1, arg2, arg3 string, arg4 scm.ListOptions) ([]*scm.ContentInfo, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "List", arg0, arg1, arg2, arg3, arg4)
@ -91,13 +90,13 @@ func (m *MockContentService) List(arg0 context.Context, arg1, arg2, arg3 string,
return ret0, ret1, ret2
}
// List indicates an expected call of List.
// List indicates an expected call of List
func (mr *MockContentServiceMockRecorder) List(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockContentService)(nil).List), arg0, arg1, arg2, arg3, arg4)
}
// Update mocks base method.
// Update mocks base method
func (m *MockContentService) Update(arg0 context.Context, arg1, arg2 string, arg3 *scm.ContentParams) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Update", arg0, arg1, arg2, arg3)
@ -106,36 +105,36 @@ func (m *MockContentService) Update(arg0 context.Context, arg1, arg2 string, arg
return ret0, ret1
}
// Update indicates an expected call of Update.
// Update indicates an expected call of Update
func (mr *MockContentServiceMockRecorder) Update(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Update", reflect.TypeOf((*MockContentService)(nil).Update), arg0, arg1, arg2, arg3)
}
// MockGitService is a mock of GitService interface.
// MockGitService is a mock of GitService interface
type MockGitService struct {
ctrl *gomock.Controller
recorder *MockGitServiceMockRecorder
}
// MockGitServiceMockRecorder is the mock recorder for MockGitService.
// MockGitServiceMockRecorder is the mock recorder for MockGitService
type MockGitServiceMockRecorder struct {
mock *MockGitService
}
// NewMockGitService creates a new mock instance.
// NewMockGitService creates a new mock instance
func NewMockGitService(ctrl *gomock.Controller) *MockGitService {
mock := &MockGitService{ctrl: ctrl}
mock.recorder = &MockGitServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockGitService) EXPECT() *MockGitServiceMockRecorder {
return m.recorder
}
// CompareChanges mocks base method.
// CompareChanges mocks base method
func (m *MockGitService) CompareChanges(arg0 context.Context, arg1, arg2, arg3 string, arg4 scm.ListOptions) ([]*scm.Change, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CompareChanges", arg0, arg1, arg2, arg3, arg4)
@ -145,28 +144,13 @@ func (m *MockGitService) CompareChanges(arg0 context.Context, arg1, arg2, arg3 s
return ret0, ret1, ret2
}
// CompareChanges indicates an expected call of CompareChanges.
// CompareChanges indicates an expected call of CompareChanges
func (mr *MockGitServiceMockRecorder) CompareChanges(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompareChanges", reflect.TypeOf((*MockGitService)(nil).CompareChanges), arg0, arg1, arg2, arg3, arg4)
}
// CreateBranch mocks base method.
func (m *MockGitService) CreateBranch(arg0 context.Context, arg1 string, arg2 *scm.CreateBranch) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateBranch", arg0, arg1, arg2)
ret0, _ := ret[0].(*scm.Response)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateBranch indicates an expected call of CreateBranch.
func (mr *MockGitServiceMockRecorder) CreateBranch(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateBranch", reflect.TypeOf((*MockGitService)(nil).CreateBranch), arg0, arg1, arg2)
}
// FindBranch mocks base method.
// FindBranch mocks base method
func (m *MockGitService) FindBranch(arg0 context.Context, arg1, arg2 string) (*scm.Reference, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindBranch", arg0, arg1, arg2)
@ -176,13 +160,13 @@ func (m *MockGitService) FindBranch(arg0 context.Context, arg1, arg2 string) (*s
return ret0, ret1, ret2
}
// FindBranch indicates an expected call of FindBranch.
// FindBranch indicates an expected call of FindBranch
func (mr *MockGitServiceMockRecorder) FindBranch(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindBranch", reflect.TypeOf((*MockGitService)(nil).FindBranch), arg0, arg1, arg2)
}
// FindCommit mocks base method.
// FindCommit mocks base method
func (m *MockGitService) FindCommit(arg0 context.Context, arg1, arg2 string) (*scm.Commit, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindCommit", arg0, arg1, arg2)
@ -192,13 +176,13 @@ func (m *MockGitService) FindCommit(arg0 context.Context, arg1, arg2 string) (*s
return ret0, ret1, ret2
}
// FindCommit indicates an expected call of FindCommit.
// FindCommit indicates an expected call of FindCommit
func (mr *MockGitServiceMockRecorder) FindCommit(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindCommit", reflect.TypeOf((*MockGitService)(nil).FindCommit), arg0, arg1, arg2)
}
// FindTag mocks base method.
// FindTag mocks base method
func (m *MockGitService) FindTag(arg0 context.Context, arg1, arg2 string) (*scm.Reference, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindTag", arg0, arg1, arg2)
@ -208,13 +192,13 @@ func (m *MockGitService) FindTag(arg0 context.Context, arg1, arg2 string) (*scm.
return ret0, ret1, ret2
}
// FindTag indicates an expected call of FindTag.
// FindTag indicates an expected call of FindTag
func (mr *MockGitServiceMockRecorder) FindTag(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindTag", reflect.TypeOf((*MockGitService)(nil).FindTag), arg0, arg1, arg2)
}
// ListBranches mocks base method.
// ListBranches mocks base method
func (m *MockGitService) ListBranches(arg0 context.Context, arg1 string, arg2 scm.ListOptions) ([]*scm.Reference, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListBranches", arg0, arg1, arg2)
@ -224,13 +208,13 @@ func (m *MockGitService) ListBranches(arg0 context.Context, arg1 string, arg2 sc
return ret0, ret1, ret2
}
// ListBranches indicates an expected call of ListBranches.
// ListBranches indicates an expected call of ListBranches
func (mr *MockGitServiceMockRecorder) ListBranches(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBranches", reflect.TypeOf((*MockGitService)(nil).ListBranches), arg0, arg1, arg2)
}
// ListChanges mocks base method.
// ListChanges mocks base method
func (m *MockGitService) ListChanges(arg0 context.Context, arg1, arg2 string, arg3 scm.ListOptions) ([]*scm.Change, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListChanges", arg0, arg1, arg2, arg3)
@ -240,13 +224,13 @@ func (m *MockGitService) ListChanges(arg0 context.Context, arg1, arg2 string, ar
return ret0, ret1, ret2
}
// ListChanges indicates an expected call of ListChanges.
// ListChanges indicates an expected call of ListChanges
func (mr *MockGitServiceMockRecorder) ListChanges(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChanges", reflect.TypeOf((*MockGitService)(nil).ListChanges), arg0, arg1, arg2, arg3)
}
// ListCommits mocks base method.
// ListCommits mocks base method
func (m *MockGitService) ListCommits(arg0 context.Context, arg1 string, arg2 scm.CommitListOptions) ([]*scm.Commit, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListCommits", arg0, arg1, arg2)
@ -256,13 +240,13 @@ func (m *MockGitService) ListCommits(arg0 context.Context, arg1 string, arg2 scm
return ret0, ret1, ret2
}
// ListCommits indicates an expected call of ListCommits.
// ListCommits indicates an expected call of ListCommits
func (mr *MockGitServiceMockRecorder) ListCommits(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCommits", reflect.TypeOf((*MockGitService)(nil).ListCommits), arg0, arg1, arg2)
}
// ListTags mocks base method.
// ListTags mocks base method
func (m *MockGitService) ListTags(arg0 context.Context, arg1 string, arg2 scm.ListOptions) ([]*scm.Reference, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListTags", arg0, arg1, arg2)
@ -272,36 +256,36 @@ func (m *MockGitService) ListTags(arg0 context.Context, arg1 string, arg2 scm.Li
return ret0, ret1, ret2
}
// ListTags indicates an expected call of ListTags.
// ListTags indicates an expected call of ListTags
func (mr *MockGitServiceMockRecorder) ListTags(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListTags", reflect.TypeOf((*MockGitService)(nil).ListTags), arg0, arg1, arg2)
}
// MockOrganizationService is a mock of OrganizationService interface.
// MockOrganizationService is a mock of OrganizationService interface
type MockOrganizationService struct {
ctrl *gomock.Controller
recorder *MockOrganizationServiceMockRecorder
}
// MockOrganizationServiceMockRecorder is the mock recorder for MockOrganizationService.
// MockOrganizationServiceMockRecorder is the mock recorder for MockOrganizationService
type MockOrganizationServiceMockRecorder struct {
mock *MockOrganizationService
}
// NewMockOrganizationService creates a new mock instance.
// NewMockOrganizationService creates a new mock instance
func NewMockOrganizationService(ctrl *gomock.Controller) *MockOrganizationService {
mock := &MockOrganizationService{ctrl: ctrl}
mock.recorder = &MockOrganizationServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockOrganizationService) EXPECT() *MockOrganizationServiceMockRecorder {
return m.recorder
}
// Find mocks base method.
// Find mocks base method
func (m *MockOrganizationService) Find(arg0 context.Context, arg1 string) (*scm.Organization, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0, arg1)
@ -311,13 +295,13 @@ func (m *MockOrganizationService) Find(arg0 context.Context, arg1 string) (*scm.
return ret0, ret1, ret2
}
// Find indicates an expected call of Find.
// Find indicates an expected call of Find
func (mr *MockOrganizationServiceMockRecorder) Find(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockOrganizationService)(nil).Find), arg0, arg1)
}
// FindMembership mocks base method.
// FindMembership mocks base method
func (m *MockOrganizationService) FindMembership(arg0 context.Context, arg1, arg2 string) (*scm.Membership, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindMembership", arg0, arg1, arg2)
@ -327,13 +311,13 @@ func (m *MockOrganizationService) FindMembership(arg0 context.Context, arg1, arg
return ret0, ret1, ret2
}
// FindMembership indicates an expected call of FindMembership.
// FindMembership indicates an expected call of FindMembership
func (mr *MockOrganizationServiceMockRecorder) FindMembership(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindMembership", reflect.TypeOf((*MockOrganizationService)(nil).FindMembership), arg0, arg1, arg2)
}
// List mocks base method.
// List mocks base method
func (m *MockOrganizationService) List(arg0 context.Context, arg1 scm.ListOptions) ([]*scm.Organization, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "List", arg0, arg1)
@ -343,36 +327,36 @@ func (m *MockOrganizationService) List(arg0 context.Context, arg1 scm.ListOption
return ret0, ret1, ret2
}
// List indicates an expected call of List.
// List indicates an expected call of List
func (mr *MockOrganizationServiceMockRecorder) List(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockOrganizationService)(nil).List), arg0, arg1)
}
// MockPullRequestService is a mock of PullRequestService interface.
// MockPullRequestService is a mock of PullRequestService interface
type MockPullRequestService struct {
ctrl *gomock.Controller
recorder *MockPullRequestServiceMockRecorder
}
// MockPullRequestServiceMockRecorder is the mock recorder for MockPullRequestService.
// MockPullRequestServiceMockRecorder is the mock recorder for MockPullRequestService
type MockPullRequestServiceMockRecorder struct {
mock *MockPullRequestService
}
// NewMockPullRequestService creates a new mock instance.
// NewMockPullRequestService creates a new mock instance
func NewMockPullRequestService(ctrl *gomock.Controller) *MockPullRequestService {
mock := &MockPullRequestService{ctrl: ctrl}
mock.recorder = &MockPullRequestServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockPullRequestService) EXPECT() *MockPullRequestServiceMockRecorder {
return m.recorder
}
// Close mocks base method.
// Close mocks base method
func (m *MockPullRequestService) Close(arg0 context.Context, arg1 string, arg2 int) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close", arg0, arg1, arg2)
@ -381,13 +365,13 @@ func (m *MockPullRequestService) Close(arg0 context.Context, arg1 string, arg2 i
return ret0, ret1
}
// Close indicates an expected call of Close.
// Close indicates an expected call of Close
func (mr *MockPullRequestServiceMockRecorder) Close(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockPullRequestService)(nil).Close), arg0, arg1, arg2)
}
// Create mocks base method.
// Create mocks base method
func (m *MockPullRequestService) Create(arg0 context.Context, arg1 string, arg2 *scm.PullRequestInput) (*scm.PullRequest, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Create", arg0, arg1, arg2)
@ -397,13 +381,13 @@ func (m *MockPullRequestService) Create(arg0 context.Context, arg1 string, arg2
return ret0, ret1, ret2
}
// Create indicates an expected call of Create.
// Create indicates an expected call of Create
func (mr *MockPullRequestServiceMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MockPullRequestService)(nil).Create), arg0, arg1, arg2)
}
// CreateComment mocks base method.
// CreateComment mocks base method
func (m *MockPullRequestService) CreateComment(arg0 context.Context, arg1 string, arg2 int, arg3 *scm.CommentInput) (*scm.Comment, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateComment", arg0, arg1, arg2, arg3)
@ -413,13 +397,13 @@ func (m *MockPullRequestService) CreateComment(arg0 context.Context, arg1 string
return ret0, ret1, ret2
}
// CreateComment indicates an expected call of CreateComment.
// CreateComment indicates an expected call of CreateComment
func (mr *MockPullRequestServiceMockRecorder) CreateComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateComment", reflect.TypeOf((*MockPullRequestService)(nil).CreateComment), arg0, arg1, arg2, arg3)
}
// DeleteComment mocks base method.
// DeleteComment mocks base method
func (m *MockPullRequestService) DeleteComment(arg0 context.Context, arg1 string, arg2, arg3 int) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteComment", arg0, arg1, arg2, arg3)
@ -428,13 +412,13 @@ func (m *MockPullRequestService) DeleteComment(arg0 context.Context, arg1 string
return ret0, ret1
}
// DeleteComment indicates an expected call of DeleteComment.
// DeleteComment indicates an expected call of DeleteComment
func (mr *MockPullRequestServiceMockRecorder) DeleteComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteComment", reflect.TypeOf((*MockPullRequestService)(nil).DeleteComment), arg0, arg1, arg2, arg3)
}
// Find mocks base method.
// Find mocks base method
func (m *MockPullRequestService) Find(arg0 context.Context, arg1 string, arg2 int) (*scm.PullRequest, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0, arg1, arg2)
@ -444,13 +428,13 @@ func (m *MockPullRequestService) Find(arg0 context.Context, arg1 string, arg2 in
return ret0, ret1, ret2
}
// Find indicates an expected call of Find.
// Find indicates an expected call of Find
func (mr *MockPullRequestServiceMockRecorder) Find(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockPullRequestService)(nil).Find), arg0, arg1, arg2)
}
// FindComment mocks base method.
// FindComment mocks base method
func (m *MockPullRequestService) FindComment(arg0 context.Context, arg1 string, arg2, arg3 int) (*scm.Comment, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindComment", arg0, arg1, arg2, arg3)
@ -460,13 +444,13 @@ func (m *MockPullRequestService) FindComment(arg0 context.Context, arg1 string,
return ret0, ret1, ret2
}
// FindComment indicates an expected call of FindComment.
// FindComment indicates an expected call of FindComment
func (mr *MockPullRequestServiceMockRecorder) FindComment(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindComment", reflect.TypeOf((*MockPullRequestService)(nil).FindComment), arg0, arg1, arg2, arg3)
}
// List mocks base method.
// List mocks base method
func (m *MockPullRequestService) List(arg0 context.Context, arg1 string, arg2 scm.PullRequestListOptions) ([]*scm.PullRequest, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "List", arg0, arg1, arg2)
@ -476,13 +460,13 @@ func (m *MockPullRequestService) List(arg0 context.Context, arg1 string, arg2 sc
return ret0, ret1, ret2
}
// List indicates an expected call of List.
// List indicates an expected call of List
func (mr *MockPullRequestServiceMockRecorder) List(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockPullRequestService)(nil).List), arg0, arg1, arg2)
}
// ListChanges mocks base method.
// ListChanges mocks base method
func (m *MockPullRequestService) ListChanges(arg0 context.Context, arg1 string, arg2 int, arg3 scm.ListOptions) ([]*scm.Change, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListChanges", arg0, arg1, arg2, arg3)
@ -492,13 +476,13 @@ func (m *MockPullRequestService) ListChanges(arg0 context.Context, arg1 string,
return ret0, ret1, ret2
}
// ListChanges indicates an expected call of ListChanges.
// ListChanges indicates an expected call of ListChanges
func (mr *MockPullRequestServiceMockRecorder) ListChanges(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListChanges", reflect.TypeOf((*MockPullRequestService)(nil).ListChanges), arg0, arg1, arg2, arg3)
}
// ListComments mocks base method.
// ListComments mocks base method
func (m *MockPullRequestService) ListComments(arg0 context.Context, arg1 string, arg2 int, arg3 scm.ListOptions) ([]*scm.Comment, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListComments", arg0, arg1, arg2, arg3)
@ -508,29 +492,13 @@ func (m *MockPullRequestService) ListComments(arg0 context.Context, arg1 string,
return ret0, ret1, ret2
}
// ListComments indicates an expected call of ListComments.
// ListComments indicates an expected call of ListComments
func (mr *MockPullRequestServiceMockRecorder) ListComments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListComments", reflect.TypeOf((*MockPullRequestService)(nil).ListComments), arg0, arg1, arg2, arg3)
}
// ListCommits mocks base method.
func (m *MockPullRequestService) ListCommits(arg0 context.Context, arg1 string, arg2 int, arg3 scm.ListOptions) ([]*scm.Commit, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListCommits", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].([]*scm.Commit)
ret1, _ := ret[1].(*scm.Response)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
// ListCommits indicates an expected call of ListCommits.
func (mr *MockPullRequestServiceMockRecorder) ListCommits(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListCommits", reflect.TypeOf((*MockPullRequestService)(nil).ListCommits), arg0, arg1, arg2, arg3)
}
// Merge mocks base method.
// Merge mocks base method
func (m *MockPullRequestService) Merge(arg0 context.Context, arg1 string, arg2 int) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Merge", arg0, arg1, arg2)
@ -539,36 +507,36 @@ func (m *MockPullRequestService) Merge(arg0 context.Context, arg1 string, arg2 i
return ret0, ret1
}
// Merge indicates an expected call of Merge.
// Merge indicates an expected call of Merge
func (mr *MockPullRequestServiceMockRecorder) Merge(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Merge", reflect.TypeOf((*MockPullRequestService)(nil).Merge), arg0, arg1, arg2)
}
// MockRepositoryService is a mock of RepositoryService interface.
// MockRepositoryService is a mock of RepositoryService interface
type MockRepositoryService struct {
ctrl *gomock.Controller
recorder *MockRepositoryServiceMockRecorder
}
// MockRepositoryServiceMockRecorder is the mock recorder for MockRepositoryService.
// MockRepositoryServiceMockRecorder is the mock recorder for MockRepositoryService
type MockRepositoryServiceMockRecorder struct {
mock *MockRepositoryService
}
// NewMockRepositoryService creates a new mock instance.
// NewMockRepositoryService creates a new mock instance
func NewMockRepositoryService(ctrl *gomock.Controller) *MockRepositoryService {
mock := &MockRepositoryService{ctrl: ctrl}
mock.recorder = &MockRepositoryServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockRepositoryService) EXPECT() *MockRepositoryServiceMockRecorder {
return m.recorder
}
// CreateHook mocks base method.
// CreateHook mocks base method
func (m *MockRepositoryService) CreateHook(arg0 context.Context, arg1 string, arg2 *scm.HookInput) (*scm.Hook, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateHook", arg0, arg1, arg2)
@ -578,13 +546,13 @@ func (m *MockRepositoryService) CreateHook(arg0 context.Context, arg1 string, ar
return ret0, ret1, ret2
}
// CreateHook indicates an expected call of CreateHook.
// CreateHook indicates an expected call of CreateHook
func (mr *MockRepositoryServiceMockRecorder) CreateHook(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHook", reflect.TypeOf((*MockRepositoryService)(nil).CreateHook), arg0, arg1, arg2)
}
// CreateStatus mocks base method.
// CreateStatus mocks base method
func (m *MockRepositoryService) CreateStatus(arg0 context.Context, arg1, arg2 string, arg3 *scm.StatusInput) (*scm.Status, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateStatus", arg0, arg1, arg2, arg3)
@ -594,13 +562,13 @@ func (m *MockRepositoryService) CreateStatus(arg0 context.Context, arg1, arg2 st
return ret0, ret1, ret2
}
// CreateStatus indicates an expected call of CreateStatus.
// CreateStatus indicates an expected call of CreateStatus
func (mr *MockRepositoryServiceMockRecorder) CreateStatus(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStatus", reflect.TypeOf((*MockRepositoryService)(nil).CreateStatus), arg0, arg1, arg2, arg3)
}
// DeleteHook mocks base method.
// DeleteHook mocks base method
func (m *MockRepositoryService) DeleteHook(arg0 context.Context, arg1, arg2 string) (*scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteHook", arg0, arg1, arg2)
@ -609,13 +577,13 @@ func (m *MockRepositoryService) DeleteHook(arg0 context.Context, arg1, arg2 stri
return ret0, ret1
}
// DeleteHook indicates an expected call of DeleteHook.
// DeleteHook indicates an expected call of DeleteHook
func (mr *MockRepositoryServiceMockRecorder) DeleteHook(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteHook", reflect.TypeOf((*MockRepositoryService)(nil).DeleteHook), arg0, arg1, arg2)
}
// Find mocks base method.
// Find mocks base method
func (m *MockRepositoryService) Find(arg0 context.Context, arg1 string) (*scm.Repository, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0, arg1)
@ -625,13 +593,13 @@ func (m *MockRepositoryService) Find(arg0 context.Context, arg1 string) (*scm.Re
return ret0, ret1, ret2
}
// Find indicates an expected call of Find.
// Find indicates an expected call of Find
func (mr *MockRepositoryServiceMockRecorder) Find(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockRepositoryService)(nil).Find), arg0, arg1)
}
// FindHook mocks base method.
// FindHook mocks base method
func (m *MockRepositoryService) FindHook(arg0 context.Context, arg1, arg2 string) (*scm.Hook, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindHook", arg0, arg1, arg2)
@ -641,13 +609,13 @@ func (m *MockRepositoryService) FindHook(arg0 context.Context, arg1, arg2 string
return ret0, ret1, ret2
}
// FindHook indicates an expected call of FindHook.
// FindHook indicates an expected call of FindHook
func (mr *MockRepositoryServiceMockRecorder) FindHook(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindHook", reflect.TypeOf((*MockRepositoryService)(nil).FindHook), arg0, arg1, arg2)
}
// FindPerms mocks base method.
// FindPerms mocks base method
func (m *MockRepositoryService) FindPerms(arg0 context.Context, arg1 string) (*scm.Perm, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindPerms", arg0, arg1)
@ -657,13 +625,13 @@ func (m *MockRepositoryService) FindPerms(arg0 context.Context, arg1 string) (*s
return ret0, ret1, ret2
}
// FindPerms indicates an expected call of FindPerms.
// FindPerms indicates an expected call of FindPerms
func (mr *MockRepositoryServiceMockRecorder) FindPerms(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindPerms", reflect.TypeOf((*MockRepositoryService)(nil).FindPerms), arg0, arg1)
}
// List mocks base method.
// List mocks base method
func (m *MockRepositoryService) List(arg0 context.Context, arg1 scm.ListOptions) ([]*scm.Repository, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "List", arg0, arg1)
@ -673,13 +641,13 @@ func (m *MockRepositoryService) List(arg0 context.Context, arg1 scm.ListOptions)
return ret0, ret1, ret2
}
// List indicates an expected call of List.
// List indicates an expected call of List
func (mr *MockRepositoryServiceMockRecorder) List(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockRepositoryService)(nil).List), arg0, arg1)
}
// ListHooks mocks base method.
// ListHooks mocks base method
func (m *MockRepositoryService) ListHooks(arg0 context.Context, arg1 string, arg2 scm.ListOptions) ([]*scm.Hook, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListHooks", arg0, arg1, arg2)
@ -689,13 +657,13 @@ func (m *MockRepositoryService) ListHooks(arg0 context.Context, arg1 string, arg
return ret0, ret1, ret2
}
// ListHooks indicates an expected call of ListHooks.
// ListHooks indicates an expected call of ListHooks
func (mr *MockRepositoryServiceMockRecorder) ListHooks(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListHooks", reflect.TypeOf((*MockRepositoryService)(nil).ListHooks), arg0, arg1, arg2)
}
// ListStatus mocks base method.
// ListStatus mocks base method
func (m *MockRepositoryService) ListStatus(arg0 context.Context, arg1, arg2 string, arg3 scm.ListOptions) ([]*scm.Status, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListStatus", arg0, arg1, arg2, arg3)
@ -705,13 +673,13 @@ func (m *MockRepositoryService) ListStatus(arg0 context.Context, arg1, arg2 stri
return ret0, ret1, ret2
}
// ListStatus indicates an expected call of ListStatus.
// ListStatus indicates an expected call of ListStatus
func (mr *MockRepositoryServiceMockRecorder) ListStatus(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListStatus", reflect.TypeOf((*MockRepositoryService)(nil).ListStatus), arg0, arg1, arg2, arg3)
}
// UpdateHook mocks base method.
// UpdateHook mocks base method
func (m *MockRepositoryService) UpdateHook(arg0 context.Context, arg1, arg2 string, arg3 *scm.HookInput) (*scm.Hook, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "UpdateHook", arg0, arg1, arg2, arg3)
@ -721,36 +689,36 @@ func (m *MockRepositoryService) UpdateHook(arg0 context.Context, arg1, arg2 stri
return ret0, ret1, ret2
}
// UpdateHook indicates an expected call of UpdateHook.
// UpdateHook indicates an expected call of UpdateHook
func (mr *MockRepositoryServiceMockRecorder) UpdateHook(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateHook", reflect.TypeOf((*MockRepositoryService)(nil).UpdateHook), arg0, arg1, arg2, arg3)
}
// MockUserService is a mock of UserService interface.
// MockUserService is a mock of UserService interface
type MockUserService struct {
ctrl *gomock.Controller
recorder *MockUserServiceMockRecorder
}
// MockUserServiceMockRecorder is the mock recorder for MockUserService.
// MockUserServiceMockRecorder is the mock recorder for MockUserService
type MockUserServiceMockRecorder struct {
mock *MockUserService
}
// NewMockUserService creates a new mock instance.
// NewMockUserService creates a new mock instance
func NewMockUserService(ctrl *gomock.Controller) *MockUserService {
mock := &MockUserService{ctrl: ctrl}
mock.recorder = &MockUserServiceMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockUserService) EXPECT() *MockUserServiceMockRecorder {
return m.recorder
}
// Find mocks base method.
// Find mocks base method
func (m *MockUserService) Find(arg0 context.Context) (*scm.User, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Find", arg0)
@ -760,13 +728,13 @@ func (m *MockUserService) Find(arg0 context.Context) (*scm.User, *scm.Response,
return ret0, ret1, ret2
}
// Find indicates an expected call of Find.
// Find indicates an expected call of Find
func (mr *MockUserServiceMockRecorder) Find(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Find", reflect.TypeOf((*MockUserService)(nil).Find), arg0)
}
// FindEmail mocks base method.
// FindEmail mocks base method
func (m *MockUserService) FindEmail(arg0 context.Context) (string, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindEmail", arg0)
@ -776,13 +744,13 @@ func (m *MockUserService) FindEmail(arg0 context.Context) (string, *scm.Response
return ret0, ret1, ret2
}
// FindEmail indicates an expected call of FindEmail.
// FindEmail indicates an expected call of FindEmail
func (mr *MockUserServiceMockRecorder) FindEmail(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindEmail", reflect.TypeOf((*MockUserService)(nil).FindEmail), arg0)
}
// FindLogin mocks base method.
// FindLogin mocks base method
func (m *MockUserService) FindLogin(arg0 context.Context, arg1 string) (*scm.User, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FindLogin", arg0, arg1)
@ -792,24 +760,8 @@ func (m *MockUserService) FindLogin(arg0 context.Context, arg1 string) (*scm.Use
return ret0, ret1, ret2
}
// FindLogin indicates an expected call of FindLogin.
// FindLogin indicates an expected call of FindLogin
func (mr *MockUserServiceMockRecorder) FindLogin(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindLogin", reflect.TypeOf((*MockUserService)(nil).FindLogin), arg0, arg1)
}
// ListEmail mocks base method
func (m *MockUserService) ListEmail(arg0 context.Context, arg1 scm.ListOptions) ([]*scm.Email, *scm.Response, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListEmail", arg0, arg1)
ret0, _ := ret[0].([]*scm.Email)
ret1, _ := ret[1].(*scm.Response)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
// ListEmail indicates an expected call of ListEmail.
func (mr *MockUserServiceMockRecorder) ListEmail(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListEmail", reflect.TypeOf((*MockUserService)(nil).ListEmail), arg0, arg1)
}

View file

@ -18,7 +18,6 @@ import (
"bytes"
"context"
"io"
"io/ioutil"
"time"
"github.com/drone/drone-yaml/yaml/converter"
@ -45,7 +44,7 @@ type (
System *core.System `json:"system"`
}
// BuildManager encapsulates complex build operations and provides
// BuildManager encapsulets complex build operations and provides
// a simplified interface for build runners.
BuildManager interface {
// Request requests the next available build stage for execution.
@ -61,15 +60,15 @@ type (
Details(ctx context.Context, stage int64) (*Context, error)
// Before signals the build step is about to start.
Before(ctx context.Context, step *core.Step) error
Before(ctxt context.Context, step *core.Step) error
// After signals the build step is complete.
After(ctx context.Context, step *core.Step) error
// BeforeAll signals the build stage is about to start.
BeforeAll(ctx context.Context, stage *core.Stage) error
// Before signals the build stage is about to start.
BeforeAll(ctxt context.Context, stage *core.Stage) error
// AfterAll signals the build stage is complete.
// After signals the build stage is complete.
AfterAll(ctx context.Context, stage *core.Stage) error
// Watch watches for build cancellation requests.
@ -83,12 +82,9 @@ type (
// UploadBytes uploads the full logs
UploadBytes(ctx context.Context, step int64, b []byte) error
// UploadCard creates a new card
UploadCard(ctx context.Context, step int64, input *core.CardInput) error
}
// Request provides filters when requesting a pending
// Request provildes filters when requesting a pending
// build from the queue. This allows an agent, for example,
// to request a build that matches its architecture and kernel.
Request struct {
@ -105,7 +101,6 @@ type (
// New returns a new Manager.
func New(
builds core.BuildStore,
cards core.CardStore,
config core.ConfigService,
converter core.ConvertService,
events core.Pubsub,
@ -125,7 +120,6 @@ func New(
) BuildManager {
return &Manager{
Builds: builds,
Cards: cards,
Config: config,
Converter: converter,
Events: events,
@ -149,7 +143,6 @@ func New(
// can more easily interact with the server.
type Manager struct {
Builds core.BuildStore
Cards core.CardStore
Config core.ConfigService
Converter core.ConvertService
Events core.Pubsub
@ -542,16 +535,3 @@ func (m *Manager) UploadBytes(ctx context.Context, step int64, data []byte) erro
}
return err
}
// UploadCard creates card for step.
func (m *Manager) UploadCard(ctx context.Context, stepId int64, input *core.CardInput) error {
data := ioutil.NopCloser(
bytes.NewBuffer(input.Data),
)
err := m.Cards.Create(ctx, stepId, data)
if err != nil {
logger := logrus.WithError(err)
logger.Warnln("manager: cannot create card")
}
return nil
}

View file

@ -9,7 +9,6 @@ package rpc
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
@ -209,10 +208,6 @@ func (s *Client) UploadBytes(ctx context.Context, step int64, data []byte) error
return s.upload(noContext, endpoint, data)
}
func (s *Client) UploadCard(ctx context.Context, step int64, input *core.CardInput) error {
return errors.New("rpc upload card not supported")
}
func (s *Client) send(ctx context.Context, path string, in, out interface{}) error {
// Source a buffer from a pool. The agent may generate a
// large number of small requests for log entries. This will

View file

@ -58,7 +58,7 @@ func (Server) Details(ctx context.Context, stage int64) (*manager.Context, error
}
// Before signals the build step is about to start.
func (Server) Before(ctx context.Context, step *core.Step) error {
func (Server) Before(ctxt context.Context, step *core.Step) error {
return errors.New("not implemented")
}
@ -68,7 +68,7 @@ func (Server) After(ctx context.Context, step *core.Step) error {
}
// Before signals the build stage is about to start.
func (Server) BeforeAll(ctx context.Context, stage *core.Stage) error {
func (Server) BeforeAll(ctxt context.Context, stage *core.Stage) error {
return errors.New("not implemented")
}

View file

@ -29,7 +29,6 @@ import (
"github.com/go-chi/chi"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/render"
"github.com/drone/drone/operator/manager"
"github.com/drone/drone/store/shared/db"
)
@ -70,7 +69,7 @@ func HandlePing() http.HandlerFunc {
}
// HandleRequest returns an http.HandlerFunc that processes an
// http.Request to request a stage from the queue for execution.
// http.Request to reqeust a stage from the queue for execution.
//
// POST /rpc/v2/stage
func HandleRequest(m manager.BuildManager) http.HandlerFunc {
@ -136,7 +135,7 @@ func HandleInfo(m manager.BuildManager) http.HandlerFunc {
writeJSON(w, &details{
Context: res,
Netrc: netrc,
Repo: &repository{
Repo: &repositroy{
Repository: res.Repo,
Secret: res.Repo.Secret,
},
@ -271,31 +270,6 @@ func HandleLogUpload(m manager.BuildManager) http.HandlerFunc {
}
}
// HandleCardUpload returns an http.HandlerFunc that accepts an
// http.Request to upload and persist a card for a pipeline step.
//
// POST /rpc/v2/step/{step}/card
func HandleCardUpload(m manager.BuildManager) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
step, _ := strconv.ParseInt(
chi.URLParam(r, "step"), 10, 64)
in := new(core.CardInput)
err := json.NewDecoder(r.Body).Decode(in)
if err != nil {
render.BadRequest(w, err)
return
}
err = m.UploadCard(noContext, step, in)
if err != nil {
writeError(w, err)
} else {
writeOK(w)
}
}
}
// write a 200 Status OK to the response body.
func writeJSON(w http.ResponseWriter, v interface{}) {
json.NewEncoder(w).Encode(v)

View file

@ -37,7 +37,6 @@ func NewServer(manager manager.BuildManager, secret string) Server {
r.Post("/build/{build}/watch", HandleWatch(manager))
r.Post("/step/{step}/logs/batch", HandleLogBatch(manager))
r.Post("/step/{step}/logs/upload", HandleLogUpload(manager))
r.Post("/step/{step}/card", HandleCardUpload(manager))
return Server(r)
}
@ -56,3 +55,4 @@ func authorization(token string) func(http.Handler) http.Handler {
})
}
}

View file

@ -16,12 +16,12 @@ import (
type details struct {
*manager.Context
Netrc *core.Netrc `json:"netrc"`
Repo *repository `json:"repository"`
Repo *repositroy `json:"repository"`
}
// repository wraps a repository object to include the secret
// when the repository is marshaled to json.
type repository struct {
type repositroy struct {
*core.Repository
Secret string `json:"secret"`
}

View file

@ -38,7 +38,7 @@ type Config struct {
}
}
// helper function reads and unmarshalls the docker-machine
// heper function reads and unmarshales the docker-machine
// configuration from a reader.
func parseReader(r io.Reader) (*Config, error) {
out := new(Config)

View file

@ -37,7 +37,7 @@ func Load(home, match string) ([]*Config, error) {
if err != nil {
return nil, err
}
// If no match logic is defined, the machine is
// If no match logic is defined, the matchine is
// automatically used as a build machine.
if match == "" {
machines = append(machines, conf)

View file

@ -222,7 +222,6 @@ func (r *Runner) Run(ctx context.Context, id int64) error {
}
if v.Name == m.Stage.Name {
pipeline = v
break
}
}
if pipeline == nil {

View file

@ -54,20 +54,15 @@ func (s *membership) Admit(ctx context.Context, user *core.User) error {
if ok {
return nil
}
// make an API call to retrive the list of organizations
// to which the user belongs.
orgs, err := s.service.List(ctx, user)
if err != nil {
return err
}
// if the user is a member of an organization in the
// account whitelist we can admit the user.
for _, org := range orgs {
_, ok := s.account[strings.ToLower(org.Name)]
if ok {
return nil
}
}
// else deny access
return ErrMembership
}

View file

@ -2,7 +2,6 @@
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
//go:build !oss
// +build !oss
package config
@ -34,7 +33,7 @@ func Global(endpoint, signer string, skipVerify bool, timeout time.Duration) cor
}
type global struct {
client config.Plugin
client config.Plugin
timeout time.Duration
}
@ -52,10 +51,6 @@ func (g *global) Find(ctx context.Context, in *core.ConfigArgs) (*core.Config, e
req := &config.Request{
Repo: toRepo(in.Repo),
Build: toBuild(in.Build),
Token: drone.Token{
Access: in.User.Token,
Refresh: in.User.Refresh,
},
}
res, err := g.client.Find(ctx, req)

View file

@ -71,7 +71,7 @@ func TestGlobalErr(t *testing.T) {
false, time.Minute)
_, err := service.Find(noContext, args)
if err == nil {
t.Errorf("Expect http.Response error")
t.Errorf("Expect http.Reponse error")
} else if err.Error() != "Not Found" {
t.Errorf("Expect Not Found error")
}

View file

@ -22,16 +22,12 @@ import (
// Combine combines the conversion services, provision support
// for multiple conversion utilities.
func Combine(multi bool, services ...core.ConvertService) core.ConvertService {
return &combined{multi: multi, sources: services}
func Combine(services ...core.ConvertService) core.ConvertService {
return &combined{services}
}
type combined struct {
sources []core.ConvertService
// this feature flag can be removed once we solve for
// https://github.com/harness/drone/pull/2994#issuecomment-795955312
multi bool
}
func (c *combined) Convert(ctx context.Context, req *core.ConvertArgs) (*core.Config, error) {
@ -46,11 +42,7 @@ func (c *combined) Convert(ctx context.Context, req *core.ConvertArgs) (*core.Co
if config.Data == "" {
continue
}
if c.multi {
req.Config = config
} else {
return config, nil
}
return config, nil
}
return req.Config, nil
}

View file

@ -39,7 +39,7 @@ func TestCombine(t *testing.T) {
service := mock.NewMockConvertService(controller)
service.EXPECT().Convert(noContext, args).Return(resp, nil)
result, err := Combine(false, service).Convert(noContext, args)
result, err := Combine(service).Convert(noContext, args)
if err != nil {
t.Error(err)
return
@ -58,7 +58,7 @@ func TestCombineErr(t *testing.T) {
service := mock.NewMockConvertService(controller)
service.EXPECT().Convert(noContext, nil).Return(nil, resp)
_, err := Combine(false, service).Convert(noContext, nil)
_, err := Combine(service).Convert(noContext, nil)
if err != resp {
t.Errorf("expected convert service error")
}
@ -85,7 +85,7 @@ func TestCombineNoConfig(t *testing.T) {
service3 := mock.NewMockConvertService(controller)
service3.EXPECT().Convert(noContext, args).Return(resp, nil)
result, err := Combine(false, service1, service2, service3).Convert(noContext, args)
result, err := Combine(service1, service2, service3).Convert(noContext, args)
if err != nil {
t.Error(err)
return
@ -110,7 +110,7 @@ func TestCombineEmptyConfig(t *testing.T) {
service1 := mock.NewMockConvertService(controller)
service1.EXPECT().Convert(noContext, args).Return(nil, nil)
result, err := Combine(false, service1).Convert(noContext, args)
result, err := Combine(service1).Convert(noContext, args)
if err != nil {
t.Error(err)
return

View file

@ -19,18 +19,14 @@ import (
// Jsonnet returns a conversion service that converts the
// jsonnet file to a yaml file.
func Jsonnet(enabled bool, limit int, fileService core.FileService) core.ConvertService {
func Jsonnet(enabled bool) core.ConvertService {
return &jsonnetPlugin{
enabled: enabled,
limit: limit,
fileService: fileService,
enabled: enabled,
}
}
type jsonnetPlugin struct {
enabled bool
limit int
fileService core.FileService
enabled bool
}
func (p *jsonnetPlugin) Convert(ctx context.Context, req *core.ConvertArgs) (*core.Config, error) {
@ -44,7 +40,7 @@ func (p *jsonnetPlugin) Convert(ctx context.Context, req *core.ConvertArgs) (*co
return nil, nil
}
file, err := jsonnet.Parse(req, p.fileService, p.limit, nil, nil)
file, err := jsonnet.Parse(req, nil, nil)
if err != nil {
return nil, err

View file

@ -2,124 +2,28 @@ package jsonnet
import (
"bytes"
"context"
"fmt"
"path"
"strconv"
"strings"
"github.com/drone/drone/core"
"github.com/drone/drone/handler/api/errors"
"github.com/google/go-jsonnet"
)
const repo = "repo."
const build = "build."
const param = "param."
var noContext = context.Background()
type importer struct {
repo *core.Repository
build *core.Build
// jsonnet does not cache file imports and may request
// the same file multiple times. We cache the files to
// duplicate API calls.
cache map[string]jsonnet.Contents
// limit the number of outbound requests. github limits
// the number of api requests per hour, so we should
// make sure that a single build does not abuse the api
// by importing dozens of files.
limit int
// counts the number of outbound requests. if the count
// exceeds the limit, the importer will return errors.
count int
fileService core.FileService
user *core.User
}
func (i *importer) Import(importedFrom, importedPath string) (contents jsonnet.Contents, foundAt string, err error) {
if i.cache == nil {
i.cache = map[string]jsonnet.Contents{}
}
// the import is relative to the imported from path. the
// imported path must resolve to a filepath relative to
// the root of the repository.
importedPath = path.Join(
path.Dir(importedFrom),
importedPath,
)
if strings.HasPrefix(importedFrom, "../") {
err = fmt.Errorf("jsonnet: cannot resolve import: %s", importedPath)
return contents, foundAt, err
}
// if the contents exist in the cache, return the
// cached item.
if contents, ok := i.cache[importedPath]; ok {
return contents, importedPath, nil
}
defer func() {
i.count++
}()
// if the import limit is exceeded log an error message.
if i.limit > 0 && i.count >= i.limit {
return contents, foundAt, errors.New("jsonnet: import limit exceeded")
}
find, err := i.fileService.Find(noContext, i.user, i.repo.Slug, i.build.After, i.build.Ref, importedPath)
if err != nil {
return contents, foundAt, err
}
i.cache[importedPath] = jsonnet.MakeContents(string(find.Data))
return i.cache[importedPath], importedPath, err
}
func Parse(req *core.ConvertArgs, fileService core.FileService, limit int, template *core.Template, templateData map[string]interface{}) (string, error) {
func Parse(req *core.ConvertArgs, template *core.Template, templateData map[string]interface{}) (string, error) {
// create the jsonnet vm
vm := jsonnet.MakeVM()
vm.MaxStack = 500
vm.StringOutput = false
vm.ErrorFormatter.SetMaxStackTraceSize(20)
if fileService != nil && limit > 0 {
vm.Importer(
&importer{
repo: req.Repo,
build: req.Build,
limit: limit,
user: req.User,
fileService: fileService,
},
)
}
//map build/repo parameters
if req.Build != nil {
mapBuild(req.Build, vm)
}
if req.Repo != nil {
mapRepo(req.Repo, vm)
}
var jsonnetFile string
var jsonnetFileName string
var jsonentFileName string
if template != nil {
jsonnetFile = template.Data
jsonnetFileName = template.Name
jsonentFileName = template.Name
} else {
jsonnetFile = req.Config.Data
jsonnetFileName = req.Repo.Config
jsonentFileName = req.Repo.Config
}
// map external inputs
if len(templateData) != 0 {
@ -129,12 +33,11 @@ func Parse(req *core.ConvertArgs, fileService core.FileService, limit int, templ
vm.ExtVar(key, val)
}
}
// convert the jsonnet file to yaml
buf := new(bytes.Buffer)
docs, err := vm.EvaluateAnonymousSnippetStream(jsonnetFileName, jsonnetFile)
docs, err := vm.EvaluateSnippetStream(jsonentFileName, jsonnetFile)
if err != nil {
doc, err2 := vm.EvaluateAnonymousSnippet(jsonnetFileName, jsonnetFile)
doc, err2 := vm.EvaluateSnippet(jsonentFileName, jsonnetFile)
if err2 != nil {
return "", err
}
@ -151,52 +54,3 @@ func Parse(req *core.ConvertArgs, fileService core.FileService, limit int, templ
return buf.String(), nil
}
func mapBuild(v *core.Build, vm *jsonnet.VM) {
vm.ExtVar(build+"event", v.Event)
vm.ExtVar(build+"action", v.Action)
vm.ExtVar(build+"environment", v.Deploy)
vm.ExtVar(build+"link", v.Link)
vm.ExtVar(build+"branch", v.Target)
vm.ExtVar(build+"source", v.Source)
vm.ExtVar(build+"before", v.Before)
vm.ExtVar(build+"after", v.After)
vm.ExtVar(build+"target", v.Target)
vm.ExtVar(build+"ref", v.Ref)
vm.ExtVar(build+"commit", v.After)
vm.ExtVar(build+"ref", v.Ref)
vm.ExtVar(build+"title", v.Title)
vm.ExtVar(build+"message", v.Message)
vm.ExtVar(build+"source_repo", v.Fork)
vm.ExtVar(build+"author_login", v.Author)
vm.ExtVar(build+"author_name", v.AuthorName)
vm.ExtVar(build+"author_email", v.AuthorEmail)
vm.ExtVar(build+"author_avatar", v.AuthorAvatar)
vm.ExtVar(build+"sender", v.Sender)
fromMap(v.Params, vm)
}
func mapRepo(v *core.Repository, vm *jsonnet.VM) {
vm.ExtVar(repo+"uid", v.UID)
vm.ExtVar(repo+"name", v.Name)
vm.ExtVar(repo+"namespace", v.Namespace)
vm.ExtVar(repo+"slug", v.Slug)
vm.ExtVar(repo+"git_http_url", v.HTTPURL)
vm.ExtVar(repo+"git_ssh_url", v.SSHURL)
vm.ExtVar(repo+"link", v.Link)
vm.ExtVar(repo+"branch", v.Branch)
vm.ExtVar(repo+"config", v.Config)
vm.ExtVar(repo+"private", strconv.FormatBool(v.Private))
vm.ExtVar(repo+"visibility", v.Visibility)
vm.ExtVar(repo+"active", strconv.FormatBool(v.Active))
vm.ExtVar(repo+"trusted", strconv.FormatBool(v.Trusted))
vm.ExtVar(repo+"protected", strconv.FormatBool(v.Protected))
vm.ExtVar(repo+"ignore_forks", strconv.FormatBool(v.IgnoreForks))
vm.ExtVar(repo+"ignore_pull_requests", strconv.FormatBool(v.IgnorePulls))
}
func fromMap(m map[string]string, vm *jsonnet.VM) {
for k, v := range m {
vm.ExtVar(build+param+k, v)
}
}

View file

@ -2,8 +2,6 @@ package jsonnet
import (
"io/ioutil"
"runtime"
"strings"
"testing"
"github.com/drone/drone/core"
@ -46,19 +44,13 @@ func TestParse(t *testing.T) {
req.Config.Data = string(before)
got, err := Parse(req, nil, 0, template, templateData)
parsedFile, err := Parse(req, template, templateData)
if err != nil {
t.Error(err)
return
}
want := string(after)
// on windows line endings are \r\n, lets change them to linux for comparison
if runtime.GOOS == "windows" {
want = strings.Replace(want, "\r\n", "\n", -1)
}
if want != got {
if want, got := parsedFile, string(after); want != got {
t.Errorf("Want %q got %q", want, got)
}
}
@ -90,19 +82,13 @@ func TestParseJsonnetNotTemplateFile(t *testing.T) {
req.Repo.Config = "plugin.jsonnet"
req.Config.Data = string(before)
got, err := Parse(req, nil, 0, nil, nil)
parsedFile, err := Parse(req, nil, nil)
if err != nil {
t.Error(err)
return
}
want := string(after)
// on windows line endings are \r\n, lets change them to linux for comparison
if runtime.GOOS == "windows" {
want = strings.Replace(want, "\r\n", "\n", -1)
}
if want != got {
if want, got := parsedFile, string(after); want != got {
t.Errorf("Want %q got %q", want, got)
}
}

View file

@ -22,6 +22,6 @@ import (
// Jsonnet returns a conversion service that converts the
// jsonnet file to a yaml file.
func Jsonnet(enabled bool, limit int, fileService core.FileService) core.ConvertService {
func Jsonnet(enabled bool) core.ConvertService {
return new(noop)
}

View file

@ -10,9 +10,6 @@ import (
"testing"
"github.com/drone/drone/core"
"github.com/drone/drone/mock"
"github.com/golang/mock/gomock"
)
const jsonnetFile = `{"foo": "bar"}`
@ -29,32 +26,12 @@ const jsonnetStreamAfter = `---
}
`
const jsonnetFileImport = `local step = import '.step.libsonnet';
{"foo": ["bar"], "steps": [step]}`
const jsonnetFileImportLib = `{"image": "app"}`
const jsonnetFileImportAfter = `---
{
"foo": [
"bar"
],
"steps": [
{
"image": "app"
}
]
}
`
const jsonnetFileMultipleImports = `local step = import '.step.libsonnet';
local step2 = import '.step2.jsonnet';
{"foo": ["bar"], "steps": [step, step2]}`
func TestJsonnet_Stream(t *testing.T) {
args := &core.ConvertArgs{
Repo: &core.Repository{Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetStream},
}
service := Jsonnet(true, 0, nil)
service := Jsonnet(true)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
@ -74,7 +51,7 @@ func TestJsonnet_Snippet(t *testing.T) {
Repo: &core.Repository{Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFile},
}
service := Jsonnet(true, 0, nil)
service := Jsonnet(true)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
@ -94,7 +71,7 @@ func TestJsonnet_Error(t *testing.T) {
Repo: &core.Repository{Config: ".drone.jsonnet"},
Config: &core.Config{Data: "\\"}, // invalid jsonnet
}
service := Jsonnet(true, 0, nil)
service := Jsonnet(true)
_, err := service.Convert(noContext, args)
if err == nil {
t.Errorf("Expect jsonnet parsing error, got nil")
@ -102,7 +79,7 @@ func TestJsonnet_Error(t *testing.T) {
}
func TestJsonnet_Disabled(t *testing.T) {
service := Jsonnet(false, 0, nil)
service := Jsonnet(false)
res, err := service.Convert(noContext, nil)
if err != nil {
t.Error(err)
@ -116,7 +93,7 @@ func TestJsonnet_NotJsonnet(t *testing.T) {
args := &core.ConvertArgs{
Repo: &core.Repository{Config: ".drone.yml"},
}
service := Jsonnet(true, 0, nil)
service := Jsonnet(true)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
@ -125,169 +102,3 @@ func TestJsonnet_NotJsonnet(t *testing.T) {
t.Errorf("Expect nil response when not jsonnet")
}
}
func TestJsonnet_Import(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFileImport},
User: &core.User{
Token: "foobar",
},
}
importedContent := &core.File{
Data: []byte(jsonnetFileImportLib),
}
controller := gomock.NewController(t)
mockFileService := mock.NewMockFileService(controller)
mockFileService.EXPECT().Find(gomock.Any(), &core.User{Token: "foobar"}, "octocat/hello-world", "542ed565d03dab86f079798f937663ec1f05360b", "a6586b3db244fb6b1198f2b25c213ded5b44f9fa", ".step.libsonnet").Return(importedContent, nil).Times(2)
service := Jsonnet(true, 1, mockFileService)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
}
if got, want := res.Data, jsonnetFileImportAfter; got != want {
t.Errorf("Want converted file:\n%q\ngot\n%q", want, got)
}
}
func TestJsonnet_ImportLimit(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFileMultipleImports},
User: &core.User{
Token: "foobar",
},
}
importedContent := &core.File{
Data: []byte(jsonnetFileImportLib),
}
controller := gomock.NewController(t)
mockFileService := mock.NewMockFileService(controller)
mockFileService.EXPECT().Find(gomock.Any(), &core.User{Token: "foobar"}, "octocat/hello-world", "542ed565d03dab86f079798f937663ec1f05360b", "a6586b3db244fb6b1198f2b25c213ded5b44f9fa", ".step.libsonnet").Return(importedContent, nil).Times(2)
service := Jsonnet(true, 1, mockFileService)
_, err := service.Convert(noContext, args)
if err == nil {
t.Errorf("Expect nil response when jsonnet import limit is exceeded")
}
}
func TestJsonnet_LimitZero(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFile},
User: &core.User{
Token: "foobar",
},
}
controller := gomock.NewController(t)
mockFileService := mock.NewMockFileService(controller)
mockFileService.EXPECT().Find(gomock.Any(), &core.User{Token: "foobar"}, "octocat/hello-world", "542ed565d03dab86f079798f937663ec1f05360b", "a6586b3db244fb6b1198f2b25c213ded5b44f9fa", ".step.libsonnet").Times(0)
service := Jsonnet(true, 0, mockFileService)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
return
}
if got, want := res.Data, jsonnetFileAfter; got != want {
t.Errorf("Want converted file %q, got %q", want, got)
}
}
func TestJsonnet_ImportLimitZero(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFileImport},
User: &core.User{
Token: "foobar",
},
}
importedContent := &core.File{
Data: []byte(jsonnetFileImportLib),
}
controller := gomock.NewController(t)
mockFileService := mock.NewMockFileService(controller)
mockFileService.EXPECT().Find(gomock.Any(), &core.User{Token: "foobar"}, "octocat/hello-world", "542ed565d03dab86f079798f937663ec1f05360b", "a6586b3db244fb6b1198f2b25c213ded5b44f9fa", ".step.libsonnet").Return(importedContent, nil).Times(2)
service := Jsonnet(true, 0, mockFileService)
_, err := service.Convert(noContext, args)
if err == nil {
t.Errorf("Expect nil response when jsonnet import limit is exceeded")
}
}
func TestJsonnet_ImportFileServiceNil(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFileMultipleImports},
User: &core.User{
Token: "foobar",
},
}
service := Jsonnet(true, 1, nil)
_, err := service.Convert(noContext, args)
if err == nil {
t.Errorf("Expect nil response when jsonnet import limit is exceeded")
}
}
func TestJsonnet_FileServiceNil(t *testing.T) {
args := &core.ConvertArgs{
Build: &core.Build{
Ref: "a6586b3db244fb6b1198f2b25c213ded5b44f9fa",
After: "542ed565d03dab86f079798f937663ec1f05360b",
},
Repo: &core.Repository{
Slug: "octocat/hello-world",
Config: ".drone.jsonnet"},
Config: &core.Config{Data: jsonnetFile},
User: &core.User{
Token: "foobar",
},
}
service := Jsonnet(true, 1, nil)
res, err := service.Convert(noContext, args)
if err != nil {
t.Error(err)
return
}
if got, want := res.Data, jsonnetFileAfter; got != want {
t.Errorf("Want converted file %q, got %q", want, got)
}
}

View file

@ -2,7 +2,6 @@
// Use of this source code is governed by the Drone Non-Commercial License
// that can be found in the LICENSE file.
//go:build !oss
// +build !oss
package converter
@ -37,7 +36,7 @@ func Remote(endpoint, signer, extension string, skipVerify bool, timeout time.Du
type remote struct {
client converter.Plugin
extension string
timeout time.Duration
timeout time.Duration
}
func (g *remote) Convert(ctx context.Context, in *core.ConvertArgs) (*core.Config, error) {
@ -62,10 +61,6 @@ func (g *remote) Convert(ctx context.Context, in *core.ConvertArgs) (*core.Confi
Config: drone.Config{
Data: in.Config.Data,
},
Token: drone.Token{
Access: in.User.Token,
Refresh: in.User.Refresh,
},
}
res, err := g.client.Convert(ctx, req)

Some files were not shown because too many files have changed in this diff Show more