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

Added saving command to annotation feature #733

Merged
merged 1 commit into from Aug 14, 2017

Conversation

surajnarwade
Copy link
Contributor

@surajnarwade surajnarwade commented Aug 1, 2017

This will save kompose command and version to annoatations, which were used to generate artifacts.
Fixes #639

@kompose-bot
Copy link
Collaborator

@surajnarwade, thank you for the pull request! We'll ping some people to review your PR. @procrypt and @cdrage, please review this.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 1, 2017
@cdrage
Copy link
Member

cdrage commented Aug 1, 2017

Couple of files have been added by accident and need to be deleted:

build/a
*.coverprofile

@cdrage
Copy link
Member

cdrage commented Aug 1, 2017

Can you please also separate the commits so we can review this easier (one for code change, other for test changes)

@surajnarwade surajnarwade force-pushed the save-cmd branch 3 times, most recently from 2132f6e to 13d68fa Compare August 2, 2017 12:27
@@ -32,6 +32,7 @@ import (
)

func newServiceConfig() kobject.ServiceConfig {
fmt.Println()
Copy link
Member

Choose a reason for hiding this comment

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

random fmt.Println()?

}
//if !equalStringMaps(config.Annotations, meta.Annotations) {
// return fmt.Errorf("Found different annotations: %#v vs. %#v", config.Annotations, meta.Annotations)
//}
Copy link
Member

Choose a reason for hiding this comment

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

should be removed, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should keep it, as it's test for annotation, but it's big blocker for test so I commented it

Copy link
Member

Choose a reason for hiding this comment

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

Okay, maybe re-adding it back would be a good idea or pushing it to a separate test.

Copy link
Member

Choose a reason for hiding this comment

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

@surajnarwade create an issue for tracking it, otherwise it will just slip from everyone's mind

@@ -114,7 +116,14 @@ func ConfigAnnotations(service kobject.ServiceConfig) map[string]string {
for key, value := range service.Annotations {
annotations[key] = value
}
annotations["kompose.cmd"] = strings.Join(os.Args, " ")
version := exec.Command("kompose", "version")
Copy link
Member

Choose a reason for hiding this comment

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

I don't like how we have an exec command here... but I don't think there's an alternative way to do this getting the actual Git hash...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no option for that as of now

@cdrage
Copy link
Member

cdrage commented Aug 4, 2017

Let's wait until @kadel get's back for him to review this. But other than uncommenting those tests / separating them, LGTM.

@surajnarwade
Copy link
Contributor Author

@kadel , needs your review here

@surajssd
Copy link
Member

surajssd commented Aug 8, 2017

@surajnarwade also add fixes to your first comment in this PR, so that the issue tracking this PR will be closed as soon as this is merged

Copy link
Member

@surajssd surajssd left a comment

Choose a reason for hiding this comment

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

LGTM

@surajnarwade
Copy link
Contributor Author

@surajssd @cdrage , ready to merge :)

@surajssd
Copy link
Member

@surajnarwade this one #733 (comment)

@cdrage
Copy link
Member

cdrage commented Aug 10, 2017

DO NOT MERGE YET.

@surajnarwade Please update the commit message with a description of what has been implemented, including an example.

It is still blank.

This command will add `kompose command` used to generate artifacts as well as `kompose version`,
for ex,

```
metadata:
    annotations:
      kompose.cmd: kompose convert -f /home/snarwade --stdout
      kompose.version: 1.0.0 (HEAD)
```

For functional test, Now each test has template like,

```
 "annotations": {
           "kompose.cmd": "%CMD%",
           "kompose.version": "%VERSION%"
```

Because, for every machine these values will be different.

Updated functional test with new annotations
@surajnarwade
Copy link
Contributor Author

@cdrage updated commit message

@cdrage
Copy link
Member

cdrage commented Aug 14, 2017

Thank you @surajnarwade ! Mergin :)

@cdrage cdrage merged commit 520676d into kubernetes:master Aug 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants