Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to specify last as build number for deploy #1956

Merged
merged 1 commit into from
Mar 13, 2017
Merged

add ability to specify last as build number for deploy #1956

merged 1 commit into from
Mar 13, 2017

Conversation

vtolstov
Copy link

@vtolstov vtolstov commented Mar 7, 2017

Signed-off-by: Vasiliy Tolstov [email protected]

@vtolstov
Copy link
Author

vtolstov commented Mar 9, 2017

ping...

@tboerger
Copy link

tboerger commented Mar 9, 2017

LGTM

@bradrydzewski
Copy link

bradrydzewski commented Mar 10, 2017

my concern with this logic is that if the last build is event type pull_request it could be deployed. This should probably be taken into account in the logic. It is probably also desirable to allow the user to specify a branch, and if no branch is specified maybe use the default branch?

drone/deploy.go Outdated
return err
}
for _, build := range builds {
if build.Status == model.StatusSuccess && build.Event != model.EventDeploy {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about pull_request events?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also should consider teams that may want to filter out certain branches, to avoid deploying a feature branch. In the documentation, for example, we recommend the following code for launching jobs which takes branch into account:

drone build start --fork octocat/hello-world \
  $(drone build last --format="{{ .Number }}" --branch=master octocat/hello-world)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't know about pull_requests , but may be good to filter it out, because in case of pr we can take exact number...
About branch suggestion - ok

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or may be simple add params for event type and branch ? so by default it uses only push event type, but if user wants it can be deploy event and pull request...? what do you think?

@vtolstov
Copy link
Author

@bradrydzewski i'm change params and use sane defaults. So if user does not specify anything and use last keyword, deploy uses push event, with status success and master branch.

@vtolstov
Copy link
Author

gentle ping... (sorry i need this feature and not want to keep own repo for long time..)

drone/deploy.go Outdated
cli.StringSliceFlag{
Name: "param, p",
Usage: "custom parameters to be injected into the job environment. Format: KEY=value",
},
},
}

func eventContains(events []string, search string) bool {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this being used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! old code. fixed now

@bradrydzewski
Copy link

changes look good, just 1 question about (maybe) unused function?

@vtolstov
Copy link
Author

i'm fix issue and force pushed, so this is ready to merge! Thanks!

@bradrydzewski bradrydzewski merged commit dc5f01d into harness:master Mar 13, 2017
@vtolstov vtolstov deleted the deploy branch March 14, 2017 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants