Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to capture RTC change set id automatically via SCM CLI

Hi,


We are using SCM CLI for creating work spaces, check in, deliver etc.

When ever we do a check action a unique change set id will be generated.

How to capture the new change set id automatically.

Here each time we need to run the command scm show status then capture the change set id.

0 votes



7 answers

Permanent link

When you run the checkin command use the -j/--json option. Post that you can parse the json output to retrieve the new change set id.

1 vote

Comments

will try out and see how it goes

Here is your article which talks about the same. 


Permanent link

 'outgoing-changes' contains the list of change sets and each change sets have list of changes. In your case the change set id is listed in the following path:

{
  "workspaces": [
    {
      "components": [
        {
          ...
         "outgoing-changes": [
            {
              ...
              "uuid": "_fh_8oKwMEeewLNKffOsvgQ"
            }
          ],
        }
      ],
    }
  ]
}

1 vote

Comments

 ./scm.sh add wi "_fh_8oKwMEeewLNKffOsvgQ" 10565

Link created.

This worked.

 What do you suggest here to capture the change_set automatically upon each check in.


suppose if we create a variable it should look inside the JSON script for what type and how it can determine the change-set UUID

 

change-set UUID will be stored inside this object value pair
['workspaces'][0]['components'][0]['outgoing-changes'][0]['uuid'])


Permanent link

Hi,

the way to capture the new change set id automatically is indeed via >scm show status and then parse the output. You will alway have to embed your scm commands in some scripting for parsing and conditions.
Alternatively you can create the change set first (and then capture and parse the output of that command:
https://jazz.net/help-dev/clm/index.jsp?topic=%2Fcom.ibm.team.scm.doc%2Ftopics%2Fcreate_changeset_ex.html
and use that as input for a >scm checkin -c <changeset_id> ...

- Arne

0 votes

Comments

 upon each check-in action a new change set id will get generated. Not sure how the above solution will help


Permanent link

As a part of testing these commands out, we did check-in a file  then  ran the below command using the -j option.


Now from here how will I determine which is my change-set ID

[root@linux eclipse]# ./scm.sh status -j
{
    "workspaces": [
        {
            "components": [
                {
                    "baseline": {
                        "id": 1,
                        "name": "Initial Baseline",
                        "uuid": "_reWPU6wLEeewLNKffOsvgQ"
                    },
                    "flow-target": {
                        "incoming-flow": {
                            "name": "Project_Test_Stream",
                            "type": "STREAM",
                            "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                            "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
                        },
                        "name": "Project_Test_Stream",
                        "outgoing-flow": {
                            "name": "Project_Test_Stream",
                            "type": "STREAM",
                            "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                            "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
                        },
                        "type": "STREAM",
                        "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                        "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
                    },
                    "incoming-addition": false,
                    "incoming-changes": [
                    ],
                    "incoming-deletion": false,
                    "is_comp_loaded": true,
                    "name": "payments",
                    "outgoing-addition": false,
                    "outgoing-changes": [
                        {
                            "author": "",
                            "changes": [
                                {
                                    "inaccessible-change": false,
                                    "merges": [
                                    ],
                                    "path": "\/payments1.jar",
                                    "state": {
                                        "add": true,
                                        "conflict": false,
                                        "content_change": false,
                                        "delete": false,
                                        "move": false,
                                        "potential_conflict": false,
                                        "property_change": false
                                    },
                                    "state-id": "_fnW9xKwMEeewLNKffOsvgQ",
                                    "uuid": "_fehx4KwMEeeRDP50Db78yA"
                                },
                                {
                                    "inaccessible-change": false,
                                    "merges": [
                                    ],
                                    "path": "\/payments.jar",
                                    "state": {
                                        "add": true,
                                        "conflict": false,
                                        "content_change": false,
                                        "delete": false,
                                        "move": false,
                                        "potential_conflict": false,
                                        "property_change": false
                                    },
                                    "state-id": "_11_jJKwMEeewLNKffOsvgQ",
                                    "uuid": "_1rx3MKwMEeeMTqQSlIoxdA"
                                }
                            ],
                            "comment": "Share",
                            "modified": "08-Oct-2017 12:41 PM",
                            "state": {
                                "active": true,
                                "complete": false,
                                "conflict": false,
                                "current": true,
                                "current_merge_target": false,
                                "has_source": false,
                                "is_linked": false,
                                "is_source": false,
                                "potential_conflict": false
                            },
                            "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                            "uuid": "_fh_8oKwMEeewLNKffOsvgQ"
                        }
                    ],
                    "outgoing-deletion": false,
                    "suspended": [
                    ],
                    "type": null,
                    "uuid": "_reCtUqwLEeewLNKffOsvgQ"
                }
            ],
            "flow-target": {
                "incoming-flow": {
                    "name": "Project_Test_Stream",
                    "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                    "userId": "223994",
                    "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
                },
                "name": "Project_Test_Stream",
                "outgoing-flow": {
                    "name": "Project_Test_Stream",
                    "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                    "userId": "223994",
                    "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
                },
                "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
                "userId": "223994",
                "uuid": "_VVsf8KkHEeewLNKffOsvgQ"
            },
            "name": "user_worspace1",
            "type": "WORKSPACE",
            "url": "https:\/\/ratdev.corp.abc.com:9443\/ccm\/",
            "userId": "223994",
            "uuid": "_aJFMoKwLEeewLNKffOsvgQ"
        }
    ]

0 votes

Comments

I posted the response to this as a comment above. For reason, when I try to put it here I hit the character limit.


Permanent link

 Finally we were able to achieve close to our requirement.


Sharing those information as it might be useful for someone.

./scm.sh checkin ledger.jar  
   
./scm.sh status -j  > /root/jazz/smtools/eclipse/data.json    (Here you are directing the JSON output of the command using -j parameter to a file called data.json)

Note: Once you got the data inside the data.json file - the change-set UUID will be stored inside this object value pair
['workspaces'][0]['components'][0]['outgoing-changes'][0]['uuid'])

changeset= /usr/bin/python /root/jazz/scmtools/eclipse/script.py  (have written a python script which refer to the object value - ['workspaces'][0]['components'][0]['outgoing-changes'][0]['uuid'] and capture the UUID of outgoing change-set) and capture the UUID of outgoing changeset

echo $changeset  (displaying the output of the variable)

./scm.sh add wi "$changeset" <work item ID>  (Now we were able to substitute the change-set value with a variable called $changeset)

 ./scm.sh deliver --source userWorkspace1  --target "ABC_DEVOPS_SCM Stream"  (Finally you can try to deliver)

This helped us to capture the RTC change-set ID automatically and deliver to the stream.

0 votes


Permanent link

Now we came across a strange issue where the scm is not showing the status.


In the case above we are able to login, share files successfully, run check in command.

When running ./scm.sh status it not showing anything. Are we missing something.

Verified all the permissions all seem to be fine.  Let me know if there is any workaround to this issue.

0 votes

Comments

 In the above post you may see the same command was working fine for me. 


Permanent link

 Look like this is due to permission issue in RTC. Last day when the user was given full rights in RTC SCM project area.


It started working again. Now that we are able to see the status command update.

./scm.sh status


./scm.sh show status
Workspace: (1005) "anoop_workspace1" <-> (1001) "ABC_Test_Stream"
  Component: (1006) "Demo1"
    Baseline: (1007) 1 "Initial Baseline"
    Outgoing:
      Change sets:
        (1008) -*--@  "Share" 18-Oct-2017 09:36 AM
  

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019
× 1,381

Question asked: Oct 05 '17, 2:40 a.m.

Question was seen: 4,791 times

Last updated: Oct 18 '17, 5:30 a.m.

Confirmation Cancel Confirm