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

feat: deploy success message also displays the namespace #1090

Merged
merged 5 commits into from
Jul 6, 2022

Conversation

vyasgun
Copy link
Contributor

@vyasgun vyasgun commented Jun 29, 2022

Changes

  • Added the function's namespace to the success message after deploy
  • If the namespace in function obj is blank, display current context namespace

Fixes #1083

Release Note

Prints the namespace when a function is deployed

@knative-prow
Copy link

knative-prow bot commented Jun 29, 2022

@vyasgun: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

In response to this:

Changes

  • Added the function's namespace to the success message after deploy
  • If the namespace in function obj is blank, display default

/kind

Fixes #1083

Release Note


Docs


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow knative-prow bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 29, 2022
@codecov
Copy link

codecov bot commented Jun 29, 2022

Codecov Report

Merging #1090 (f16b3e9) into main (8109186) will decrease coverage by 2.18%.
The diff coverage is 23.07%.

@@            Coverage Diff             @@
##             main    #1090      +/-   ##
==========================================
- Coverage   47.22%   45.03%   -2.19%     
==========================================
  Files          59       64       +5     
  Lines        8028     8456     +428     
==========================================
+ Hits         3791     3808      +17     
- Misses       3855     4268     +413     
+ Partials      382      380       -2     
Impacted Files Coverage Δ
knative/deployer.go 6.12% <0.00%> (-0.04%) ⬇️
pipelines/tekton/pipeplines_provider.go 0.00% <0.00%> (ø)
client.go 61.55% <100.00%> (+1.07%) ⬆️
pipelines/tekton/tasks.go 0.00% <0.00%> (ø)
pipelines/tekton/validate.go 84.61% <0.00%> (ø)
pipelines/tekton/client.go 0.00% <0.00%> (ø)
pipelines/tekton/resources.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8109186...f16b3e9. Read the comment docs.

@lance lance changed the title Changes so func deploy success message also displays the namespace feat: deploy success message also displays the namespace Jun 29, 2022
client.go Outdated
@@ -705,10 +706,21 @@ func (c *Client) Deploy(ctx context.Context, path string) (err error) {
// Deploy a new or Update the previously-deployed Function
c.progressListener.Increment("Deploying function to the cluster")
result, err := c.deployer.Deploy(ctx, f)

var namespace string
Copy link
Contributor

Choose a reason for hiding this comment

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

The namespace is already resolved in c.deployer.Deploy(), might be better to set it in the fn.DeploymentResult and reuse here.

Copy link
Contributor Author

@vyasgun vyasgun Jun 30, 2022

Choose a reason for hiding this comment

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

Just to clarify, should I add a field for namespace in the DeploymentResult type and populate it when it's resolved in c.deployer.Deploy()?

Made the above change in the latest commit.

client.go Outdated
if result.Status == Deployed {
c.progressListener.Increment(fmt.Sprintf("Function deployed at URL: %v", result.URL))
c.progressListener.Increment(fmt.Sprintf("Function deployed in namespace %q and exposed at URL: %v", namespace, result.URL))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
c.progressListener.Increment(fmt.Sprintf("Function deployed in namespace %q and exposed at URL: %v", namespace, result.URL))
c.progressListener.Increment(fmt.Sprintf("Function deployed in namespace %q and exposed at URL: \n%v", namespace, result.URL))

See the comment: #1083 (comment)

client.go Outdated
} else if result.Status == Updated {
c.progressListener.Increment(fmt.Sprintf("Function updated at URL: %v", result.URL))
c.progressListener.Increment(fmt.Sprintf("Function updated in namespace %q and exposed at URL: %v", namespace, result.URL))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
c.progressListener.Increment(fmt.Sprintf("Function updated in namespace %q and exposed at URL: %v", namespace, result.URL))
c.progressListener.Increment(fmt.Sprintf("Function updated in namespace %q and exposed at URL: \n%v", namespace, result.URL))

See the comment: #1083 (comment)

Copy link
Contributor

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 30, 2022
Copy link
Member

@lkingland lkingland left a comment

Choose a reason for hiding this comment

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

/lgtm !

This is nice information to have very readily available on deploy.

/hold for others to take a look

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 1, 2022
@knative-prow knative-prow bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 1, 2022
Copy link
Contributor

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

/lgtm thanks for the contribution!

@knative-prow
Copy link

knative-prow bot commented Jul 1, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland, vyasgun, zroubalik

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [lkingland,zroubalik]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@vyasgun
Copy link
Contributor Author

vyasgun commented Jul 1, 2022

@zroubalik @lkingland Thanks for the reviews. I am stuck on the codecov part. I have added changes to the Deploy function but I can't see a way to use mock clients for writing unit tests.

@zroubalik
Copy link
Contributor

@vyasgun I think that's okay, the test that you have added is imho enough for this feature

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

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

/unhold

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 6, 2022
@knative-prow knative-prow bot merged commit afd224f into knative:main Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The CLI should print the namespace a function was deployed to
4 participants