Skip to content

Staging Workflow Step by Step

Saray Cabrera Padrón edited this page Oct 2, 2019 · 1 revision

Deliverable Staging Workflow (January 2019)

Intro

You can follow these steps to test the new version of the Staging Workflow.

The given examples use the fake host http://example.com, the group heroes, the user Max, the project home:Max and the packagepackage1. Feel free to use the OBS reference server https://build.opensuse.org or any other host with your own user account and your testing groups, projects and packages.

Prerequisites

1. Log in as Admin

2. Create a Group

A group is needed to create a Staging Workflow. You can create a new group called heroes or simply choose an existing one.

Direct Link: http://example.com/groups

Path: Home Page > Configuration > Manage Groups > Add Group

3. Add a Gravatar to the Group

As a new feature, every user and group can have a Gravatar. An email address is needed in order to show a Gravatar. Therefore an admin should add an email address to the group through the API as follows.

osc -A http://example.com api -X POST "/group/$GROUP_NAME?cmd=set_email&email=$EMAIL"

Example:

osc -A http://example.com api -X POST "/group/heroes?cmd=set_email&email=example@foo.de"

Workflow as Regular User

1. Log in as Regular User

You can log in with Max or with your user account.

2. Create or Choose a Project

You have to decide which is the project you want to create a Staging Workflow for (a.k.a main project). You can create a new project or use an existing one. For example, home:Max.

Direct Link: http://example.com/project

Path: Home Page > All Projects > Add New Project (or click on the project link)

3. Create a Package for the Previous Project

Having a package in the project will help us to make a request afterwards. We will use it to test our Staging Workflow. You can create package1 inside home:Max, for example.

Add also a file to this package.

Direct Link: http://example.com/package/show/home:Max/package1

Path: Home Page > Home Project > package1

4. Create Staging Workflow

Now, we are on the step that really concerns us: the Staging Workflow creation.

At the moment, the following URL is the start point to do it: http://example.com/staging_workflows/new?project=$PROJECT_NAME. As you can see, you have to set the name of the project you want to create a Staging Workflow for. A query string like ?project=home:Max has to be set.

After accessing that URL, it is compulsory to set the Managers Group. So add heroes in the text field and click on Create Staging Projects.

Two new Staging Projects are automatically created and assigned to the current Staging Workflow: Staging:Aand Staging:B.

Direct Link: http://example.com/staging_workflows/new?project=home:Max

5. Send a Request to the Project/Package We Chose Before

5.1. Go to the package package1 and click on Branch package.

5.2. Open a package file and change something in it

5.3. Click Submit package to make a request.

5.4. Go to the already created request, there is a direct link in the blue box on the top.

See on the request page that a review with heroes as reviewer was automatically created.

6. Check the Backlog

Go to Staging Workflow index page. In the Infos box, you'll find the Backlog list and check that the package package1 branched previously is there.

Direct Link: http://example.com/staging_workflows/1

7. Assign the New Request to a Staging Project

At the moment, it is only possible to do it via osc:

osc -A http://example.com api -d '<requests><number>$REQUEST_ID</number></requests>' -X POST '/staging/home:$USER/staging_projects/home:$USER:Staging:A/staged_requests'

doing it with $USER:

curl -u $USER:$PASSWORD -d '<requests><number>$REQUEST_ID</number></requests>' -X POST 'http://example.com/staging/home:$USER/staging_projects/home:$USER:Staging:A/staged_requests'

Example:

curl -u Max:opensuse -d '<requests><number>4</number></requests>' -X POST 'http://example.com/staging/home:Max/staging_projects/home:Max:Staging:A/staged_requests'

Go back to the Staging Workflow index page and you'll see that the package package1 is not in the Backlog list anymore. You will see a new entry in the Staging Project's table.

8. Check Staging Project History

Go to the Staging Project index page and scroll down to see the History.

Direct Link: http://example.com/staging_workflows/2/staging_projects/home:Max:Staging:A

Path: Staging Workflow > Click on Staging Project name

9. Create Staging Project from Template / Copy a Staging Project

Instead of creating a Staging Project from scratch, you can copy an existing one.

9.1 Go to the Staging Workflow page: http://example.com/staging_workflows/2

9.2 Click on the link Configure (the user needs to be able to manage the Staging Workflow)

9.3 Choose the Staging Project you want to copy from (the template) and click on its Copy icon on the actions column.

9.4 Enter a name for the new project and click Copy.

You'll be redirected to the Staging Workflow show page. The Staging Project copy is processing on background, so there might be a delay.

10. API Steps

Documentation at https://build.opensuse.org/apidocs/index#190

10.1. To query the overall states of all Staging Projects belonging to a Staging Workflow:

osc -A http://example.com api '/staging/home:$USER/staging_projects'

Example:

osc -A http://example.com api '/staging/home:Max/staging_projects'

10.2. Exclude two requests:

osc -A http://example.com api -X POST '/staging/home:$USER/excluded_requests' -d "<excluded_requests><request number='$REQUEST_ID_1' description='$DESCRIPTION_1'/><request number='$REQUEST_ID_2' description='$DESCRIPTION_2'/></excluded_requests>"

Example:

osc -A http://example.com api -X POST '/staging/home:Max/excluded_requests' -d "<excluded_requests><request number='19' description='hey'/><request number='20' description='hey'/></excluded_requests>"

10.3. Unexclude two requests:

osc -A http://example.com api -X DELETE '/staging/home:$USER/excluded_requests' -d "<requests><number>$REQUEST_ID_1</number><number>$REQUEST_ID_2</number></requests>"

Example:

osc -A http://example.com api -X DELETE '/staging/home:Max/excluded_requests' -d "<requests><number>19</number><number>20</number></requests>"

10.4 Assign requests to a Staging Project:

osc -A http://example.com api -X POST '/staging/home:$USER/staging_projects/home:$USER:Staging:A/staged_requests' -d '<requests><number>$REQUEST_ID</number></requests>'

Example:

osc -A http://example.com api -X POST '/staging/home:Max/staging_projects/home:Max:Staging:A/staged_requests' -d '<requests><number>19</number></requests>'

Make sure that after reloading the Staging Workflow page the home:Max:Staging:A project is not in Empty projects anymore and the request added to Staging:A is not in the Backlog section.

10.5 Unassign requests from a Staging Project:

osc -A http://example.com api -X DELETE '/staging/home:$USER/staging_projects/home:$USER:Staging:A/staged_requests' -d '<requests><number>$REQUEST_ID</number></requests>'

Example:

osc -A http://example.com api -X DELETE '/staging/home:Max/staging_projects/home:Max:Staging:A/staged_requests' -d '<requests><number>19</number></requests>'

Make sure that after reloading the Staging Workflow page the home:Max:Staging:A project is again in Empty projects and the request added to Staging:A is also again in the Backlog section.

Clone this wiki locally