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 support for new staging api. (command osc ps) #631

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lethliel
Copy link
Member

Create, Add, Delete staging projects
Add requests to staging

It can be issued within a project directory or with the
project as the first argument.

If you operate on a staging project or with requests the
staging project has to be given with -s and the request has
to be given with -r

You can add multiple requests / stagings comma serparated.
For example:

-s myprj:Staging:A, myprj:Staging:B
 -r 1234, 12345

osc ps

For example:
linux:~/myproject/> osc ps create
or
osc ps create myproject

STILL IN BETA

This fixes #583

@lethliel
Copy link
Member Author

@marcus-h: This is a beta version of the new staging command. Can we please merge this, so that the release engineers have something to test and do the refactoring aftwerwards?

Thanks and cheers,
Marco

@vpereira
Copy link
Contributor

@coolo

@marcus-h
Copy link
Member

marcus-h commented Sep 12, 2019 via email

@marcus-h
Copy link
Member

marcus-h commented Sep 12, 2019 via email

@lethliel
Copy link
Member Author

lethliel commented Sep 12, 2019 via email

@coolo
Copy link
Member

coolo commented Sep 17, 2019

coolo@f102#osc>osc ps
Traceback (most recent call last):
  File "/suse/coolo/prod/osc/osc-wrapper.py", line 41, in <module>
    r = babysitter.run(osccli)
  File "/space/prod/osc/osc/babysitter.py", line 62, in run
    return prg.main(argv)
  File "/space/prod/osc/osc/cmdln.py", line 344, in main
    return self.cmd(args)
  File "/space/prod/osc/osc/cmdln.py", line 367, in cmd
    retval = self.onecmd(argv)
  File "/space/prod/osc/osc/cmdln.py", line 501, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/space/prod/osc/osc/cmdln.py", line 1232, in _dispatch_cmd
    return handler(argv[0], opts, *args)
TypeError: do_projectstaging() missing 1 required positional argument: 'cmd'

@coolo
Copy link
Member

coolo commented Sep 17, 2019

why do I need to give the name of the staging project to remove from?

@lethliel
Copy link
Member Author

why do I need to give the name of the staging project to remove from?

Because the http_request to remove a sr is:

DELETE staging/home:mstrigl/staging_projects/Staging:A/staged_requests

and expects a xml with the requests to delete. osc does not know which request is in
which staging.

I would have to iterate over all stagings and search for the request to build the url

@coolo
Copy link
Member

coolo commented Sep 17, 2019

So you let the user do it instead?

@coolo
Copy link
Member

coolo commented Sep 17, 2019

But if that's the API, the API sucks - easy as that :)

@lethliel
Copy link
Member Author

So you let the user do it instead?

Just explaining why I did it this way :-) I will implement that osc determines the staging for the request when no staging is given with -s

@coolo
Copy link
Member

coolo commented Sep 17, 2019

I think the API should handle this, really.

Create, Add, Delete staging projects
Add requests to staging

It can be issued within a project directory or with the
project as the first argument.

If you operate on a staging project or with requests the
staging project has to be given with -s and the request has
to be given with -r

You can add multiple requests / stagings.
For example:
  "-s myprj:Staging:A -s myprj:Staging:B"
  "-r 1234 -r 12345"

osc ps

For example:
    linux:~/myproject/> osc ps create
    or
    osc ps create myproject
@lethliel
Copy link
Member Author

coolo@f102#osc>osc ps
Traceback (most recent call last):
  File "/suse/coolo/prod/osc/osc-wrapper.py", line 41, in <module>
    r = babysitter.run(osccli)
  File "/space/prod/osc/osc/babysitter.py", line 62, in run
    return prg.main(argv)
  File "/space/prod/osc/osc/cmdln.py", line 344, in main
    return self.cmd(args)
  File "/space/prod/osc/osc/cmdln.py", line 367, in cmd
    retval = self.onecmd(argv)
  File "/space/prod/osc/osc/cmdln.py", line 501, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/space/prod/osc/osc/cmdln.py", line 1232, in _dispatch_cmd
    return handler(argv[0], opts, *args)
TypeError: do_projectstaging() missing 1 required positional argument: 'cmd'

fixed

@hennevogel
Copy link
Member

@lethliel whatever you need, please file issues, we want to make this work for you 🤠

@lethliel
Copy link
Member Author

I think the API should handle this, really.

I put a work around in osc. osc now determines in which staging project the request is, when omitting the -s option

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

DELETE staging/home:mstrigl/staging_projects/Staging:A/staged_requests

@lethliel

I'm not sure, but why asking the user to provide the staging workflow project, if it could be inferred from the staging project, why not use it?

i.e:

dosc ps rq add home:Admin -s home:Admin:Staging:A -r 1 IMO should be dosc ps rq add -s home:Admin:Staging:A -r 1

@coolo
Copy link
Member

coolo commented Oct 2, 2019

How to retrieve the staging workflow for a project through API?

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

How to retrieve the staging workflow for a project through API?

Nothing is set in stone. The API is under development and should and will be adapted if necessary. The question should be always if the design make sense or not. Do you need an endpoint for that? Couldn't we solve it with one extra request?

dosc ps rq add -s home:Admin:Staging:A -r 1 would be probably the best way to go

@coolo
Copy link
Member

coolo commented Oct 2, 2019

The question is basically: does it make sense at all that the route is /staging/openSUSE:Leap:15.2/staging_projects/openSUSE:Leap:15.2:Staging:N/staged_requests if it could be /staging_projects/openSUSE:Leap:15.2:Staging:N/staged_requests

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

The question is basically: does it make sense at all that the route is /staging/openSUSE:Leap:15.2/staging_projects/openSUSE:Leap:15.2:Staging:N/staged_requests if it could be /staging_projects/openSUSE:Leap:15.2:Staging:N/staged_requests

It is a good question.. I think we were following the rails convention and the route ended up like that.. we can file an issue for that. How should the osc command look like for you @coolo ?

@coolo
Copy link
Member

coolo commented Oct 2, 2019

osc staging -p openSUSE:Leap:15.2 select N bash is what I use

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

If in the server side we had something like Project.find_by(name: 'home:Admin:Staging:A').staging_workflow then osc sp rq add -s home:Admin:Staging:A -r 1 would do the trick.

@coolo
Copy link
Member

coolo commented Oct 2, 2019

I really see no point in typing the extra :Staging: - it's a convention we will stick to

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

I really see no point in typing the extra :Staging: - it's a convention we will stick to

That's a requirement from our PO. The Staging projects are just projects. No special names or hierarchy (i.e sub-projects)

@coolo
Copy link
Member

coolo commented Oct 2, 2019

Yeah, then just don't ask me. Because I can only tell you what users want not what POs want.

@vpereira
Copy link
Contributor

vpereira commented Oct 2, 2019

Yeah, then just don't ask me. Because I can only tell you what users want not what POs want.

right @coolo but thinking about the user point of view, would it make sense to have something like dosc ps rq list -s home:Admin:Staging:A instead of dosc ps rq list home:Admin -s home:Admin:Staging:A or are you ok having to enter the project twice?

@coolo
Copy link
Member

coolo commented Oct 2, 2019

No, because in my world ps rq list home:Admin -s A is sufficient information

@vpereira
Copy link
Contributor

vpereira commented Oct 7, 2019

@lethliel I see some difference between the example workflows given my the osc ps and how it really works:

i.e:

Example Workflow:
...
osc ps request list -s myprj:Staging:A

but what really works is:

osc ps request list myprj -s myprj:Staging:A

@vpereira
Copy link
Contributor

vpereira commented Jan 9, 2020

As it is today, this command is broken. The XML format that we should send while staging a new request is similar with:

<requests><request id="9"/><request id="12"/></requests>

Today we are sending something like:

<requests><number>1</number></requests>

Please update it @lethliel

@dmach dmach marked this pull request as draft June 2, 2022 08:17
@lethliel
Copy link
Member Author

This will be closed.. Nobody seems to be using it..
And rebasing on the current codebase would be more effort than to reimplement this

@lethliel lethliel closed this Sep 21, 2022
@vpereira
Copy link
Contributor

This will be closed.. Nobody seems to be using it..
And rebasing on the current codebase would be more effort than to reimplement this

I think after 3 years, people that need it, just gave up of using osc and instead coded their own glue code around staging.

@hennevogel
Copy link
Member

We still want this...

@hennevogel hennevogel reopened this Sep 21, 2022
@lethliel
Copy link
Member Author

This will be closed.. Nobody seems to be using it..
And rebasing on the current codebase would be more effort than to reimplement this

I think after 3 years, people that need it, just gave up of using osc and instead coded their own glue code around staging.

There is also a staging plugin in osc-relese-tools. But I guess this is for the old staging API?

@lethliel
Copy link
Member Author

We still want this...

@hennevogel Then I will rebase and commit what I have so far.. So that the people can use it and report bugs ;-)

@dmach
Copy link
Contributor

dmach commented Mar 9, 2023

This pull request has been in a draft state for quite some time.
Could you either finish it, close it or add a comment that you're still planning to work on it?

@dmach
Copy link
Contributor

dmach commented Mar 29, 2023

Since this new command has subcommands, it might be good to rewrite it to use the new code from #1285 once it gets merged.

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.

[new feature] Implement command for staging API
6 participants