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 gh deployment #5541

Open
fmeriaux opened this issue Apr 28, 2022 · 13 comments · May be fixed by #8718
Open

Add gh deployment #5541

fmeriaux opened this issue Apr 28, 2022 · 13 comments · May be fixed by #8718
Labels
enhancement a request to improve CLI extension-idea An idea that could make a good GitHub CLI extension gh-run relating to the gh run command gh-workflow relating to the gh workflow command help wanted Contributions welcome

Comments

@fmeriaux
Copy link

Describe the feature or problem you’d like to solve

This suggestion has already been requested in part here.

However, although an alias would allow this, I think native commands make sense and will be easier to use.

For example, if there is no official github action to create or manipulate a deployment, or in a third party tool, we could use the CLI to manage deployments in a CI.

Proposed solution

How will it benefit CLI and its users?

The commands should allow to:

  • create a deployment
  • update its status
  • delete a deployment (for cleanup purposes)

Additional context

Add any other context like screenshots or mockups are helpful, if applicable.

@fmeriaux fmeriaux added the enhancement a request to improve CLI label Apr 28, 2022
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Apr 28, 2022
@mislav mislav removed the needs-triage needs to be reviewed label May 3, 2022
@mislav mislav added the extension-idea An idea that could make a good GitHub CLI extension label Sep 7, 2022
@brian-pickens
Copy link

May I get the go ahead to explore implementing this inside the CLI?

@pkallos
Copy link

pkallos commented Apr 24, 2023

May I get the go ahead to explore implementing this inside the CLI?

You have my explicit permission and endorsement!

@vilmibm vilmibm added the help wanted Contributions welcome label Jun 21, 2023
@OJFord
Copy link

OJFord commented Aug 19, 2023

My impression is deployments are considered a legacy feature in maintenance mode, won't receive major updates, no reason for new tooling to support them.

Note that the Action docs (though deployment is a supported trigger) don't suggest using them, the examples just lead you to do whatever you need in a job for some other trigger.

(Also note linked request was closed with rough API support, first-class command not happening any time soon comment.)

@KyleKing
Copy link

KyleKing commented Aug 19, 2023

My impression is deployments are considered a legacy feature in maintenance mode, won't receive major updates, no reason for new tooling to support them.

Note that the Action docs (though deployment is a supported trigger) don't suggest using them, the examples just lead you to do whatever you need in a job for some other trigger.

(Also note linked request was closed with rough API support, first-class command not happening any time soon comment.)

Could you link to the GitHub Action docs that recommends against using deployments or other discussion that shows that they are being treated as legacy? I didn't get that impression from: https://docs.github.com/en/actions/deployment/about-deployments/deploying-with-github-actions, and the Rest API support seems to be complete: https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28

Are you referencing this comment: #5773 (comment)?

It looks like GitHub is releasing a beta change to the Deployments UI and there seems to be no clear alternative. We are thinking about using deployments in our CD workflow, so I'm curious if they really are in maintenance-only or not.

@OJFord
Copy link

OJFord commented Aug 21, 2023

That is the docs page I had in mind @KyleKing - it talks about 'triggering your deployment ' and says 'deployments' many times, but afaict it's not talking about Deployments the feature at any point nor using them, the trigger, or the API in any of the examples.

Another thing I saw giving me that impression was #921 (comment) in the first issue requesting this (and closed).

I could well be wrong though, I don't have any inside info or anything, it's just my impression.

@brian-pickens
Copy link

Without any direct evidence I'm inclined to disagree that deployments is a legacy feature. The docs page you're referring to is specifically for GitHub actions. I wouldn't expect it to mention the APIs because deployments is already fully integrated. The APIs are meant to be integration points for 1st and 3rd party apps. Such as the github CLI.

@brian-pickens
Copy link

I would like to add that we use the deployment APIs today to communicate deployments to GitHub from our 3rd party deployment tool. Having the ability to do this in the GitHub cli would greatly simplify out scripts.

@fmeriaux
Copy link
Author

I had the same thought about the deployment feature being deprecated. When you rummage around on the possibilities and the different writings, you see that nothing evolves anymore, and that some supports are even removed, like the slack /github deploy command.

It would seem that they are working on an overhaul of the feature, at least according to the conclusion of integrations/slack#1150, but I haven't found any recent publications on the subject.

I think they have something planned, but it's not a priority. A more clearly defined position would be welcome to inform our choices about implementing certain tools in our teams.

@samcoe
Copy link
Contributor

samcoe commented Aug 21, 2023

Our team uses deployments and as far as I know the feature is not deprecated. In fact it looks like a new UI is being worked on https://github.blog/changelog/2023-07-26-github-actions-new-dashboard-view-for-deployments-across-environments-public-beta/.

@andyfeller andyfeller added gh-run relating to the gh run command gh-workflow relating to the gh workflow command labels Oct 2, 2023
@sjparkinson
Copy link

I am having a go at this in https://github.com/sjparkinson/gh/tree/add-deployment.

Currently creating a deployment works a treat, and I'm now thinking through the UI of a gh deployment edit command. It seems the most intuative command to create a deployment status with?

Reading through https://docs.github.com/en/rest/deployments/statuses#create-a-deployment-status, I'd love to hear peoples thoughts on how the flags and arg(s?) could look.

Where I'm getting stuck is also around using this in CI and passing a deployment ID around (or not somehow?), thoughts on that welcome too! Naievly what I've done so far is if there's no TTY then the deployment ID is returned by the create command, but that doesn't feel as clear as it could be?

# Create a deployment on the current branch
$ gh deployment create

# Create a deployment at a specified ref
$ gh deployment create --ref main

# Create a deployment for a specific environment
$ gh deployment create --environment test
# Update the status of a deployment
$ gh deployment edit 12345 --state success

# Update the status of the latest deployment in an
# environment? I don't think this works as you can change
# an environment for a deployment when creating a deployment status...
$ gh deployment edit --environment production --state success

# Update the status of a deployment and include a log URL
$ gh deployment edit 12345 --state in_progress --log-url https://example.com/

@RichiCoder1
Copy link

@sjparkinson that's awesome! I'm not sure "edit" is the best terminology here. Maybe update or update-status or something along those lines?

@sjparkinson
Copy link

I've now got basic commands for deployment create, deployment list and deployment delete working in trunk...sjparkinson:gh:add-deployment.

Next up is deployment update.

Thoughts on the above welcome!

@sjparkinson sjparkinson linked a pull request Feb 19, 2024 that will close this issue
@williammartin
Copy link
Member

@sjparkinson thanks for opening the PR for discussion. Sorry we missed your comment last week, none of the current maintainers have been involved in this thread so we didn't get notifications. We'll make sure to have a look and provide feedback as soon as we can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request to improve CLI extension-idea An idea that could make a good GitHub CLI extension gh-run relating to the gh run command gh-workflow relating to the gh workflow command help wanted Contributions welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.