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

Adds environment & version to Deploy events #758

Merged
merged 8 commits into from
Feb 13, 2016
Merged

Adds environment & version to Deploy events #758

merged 8 commits into from
Feb 13, 2016

Conversation

phobologic
Copy link
Contributor

Fixes GH-755

@@ -425,6 +425,9 @@ type DeploymentsCreateOpts struct {
// Image is the image that's being deployed.
Image image.Image

// Environment is the environment where the image is being deployed
Environment string
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably ok for now, but it'd probably be better in the long run if we had this on the Empire struct itself, so it works for non-github deployments. If I emp deploy <image>, I'd still expect to see the environment in the event.

That means we'd need an --environment flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm - yeah, I guess actually taking the environment FROM the github deployment isn't actually all that useful. It's not like Empire runs multiple environments. Let me think about that - doesn't seem like it'd need to be super far reaching?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the initial version could just be used for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, took a first stab at addressing this. Let me know what you think.

@ejholmes
Copy link
Contributor

lgtm if you wanna just start with this 👍

Rather than rely on the environment from the github deploy, lets just
setup an environment for the whole Empire daemon. Right now this is only
used in Deploy Events, but this is also the first step to supporting
GH-480
@@ -438,6 +448,10 @@ func (opts DeploymentsCreateOpts) Event() DeployEvent {
if opts.App != nil {
e.App = opts.App.Name
}

if opts.Environment != "" {
e.Environment = opts.Environment
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think environment should be on the DeploymentsCreateOpts at all, you can just set the Environment on the even in the Deploy method:

event.Environment = e.Environment

Which means that you don't need the GetEnvironment() method and the server doesn't need to know anything about passing it.

@phobologic
Copy link
Contributor Author

Cool updated - thanks

@@ -284,6 +287,10 @@ func (e *Empire) DomainsDestroy(ctx context.Context, domain *Domain) error {
return nil
}

func (e *Empire) GetEnvironment() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't used anymore.

@ejholmes
Copy link
Contributor

Nice! Looks like it needs a rebase, but 👍 otherwise.

@ejholmes
Copy link
Contributor

Oh, can you update the changelog as well?

@phobologic
Copy link
Contributor Author

Done!

@@ -9,6 +9,7 @@
* It's now possible to lock down the GitHub authorization to a specific team via the `--github.team.id` flag [#745](https://github.com/remind101/empire/pull/745).
* Empire can now integrate with Conveyor to build Docker images on demand when using the GitHub Deployments integration [#747](https://github.com/remind101/empire/pull/747).
* Stdout and Stdin from interactive run sessions can now be sent to CloudWatch Logs for longterm storage and auditing [#757](https://github.com/remind101/empire/pull/757).
* Add `Environment` and `Release` to Deploy Events. `--environment` will likely be used for tagging resource later. [#758](https://github.com/remind101/empire/pull/758)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, s/resource/resources/g

ejholmes added a commit that referenced this pull request Feb 13, 2016
Adds environment & version to Deploy events
@ejholmes ejholmes merged commit 21aeca6 into master Feb 13, 2016
@ejholmes ejholmes deleted the fix_755 branch February 13, 2016 00:40
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.

2 participants