UrbanCode Deploy

UrbanCode Deploy: 10 Minute tips : Importing Component Versions – Part 2

In part 1 we looked at the basic options available for importing new component versions into UCD.  This time we take a deeper look at the options available including some of the newer capabilities introduced in 7.0.1 and later.

We also touch on the change from autorun process on component version import to deployment triggers.

Last time we talked about the potential for importing incomplete versions and offered a way to avoid that but there is another potential way for this to occur.  If you are importing component versions in several chunks by using multiple udclient addVersionFiles commands and you are also using autorun processes for component versions or the newer deployment triggers, UCD won’t be able to tell when your component version is complete unless we give it more clues.

If we look at the udclient createVersion command there is a new option (since 7.0.1).  This allows us to tell UCD that we’re going to do a more complex import and that we will tell UCD specifically when the version is complete.  We might also want to do this if we want to ensure that maybe we have imported all of the new component versions for an application before we start deploying anything.   All we need to do is to add a new option –importing true on the createVersion command like this:

[root@localhost]# udclient --weburl https://localhost:8443 --username admin --password admin createVersion --component 'test component' -name 2.0 --importing true
{
  "id": "7e69fdd5-6256-43fe-a20b-1cffc646e5e8",
  "name": "2.0",
  "type": "FULL",
  "created": 1600937853370,
  "active": true,
  "archived": false,
  "sizeOnDisk": 0,
  "importing": true,
  "properties": [{
    "id": "174bf550-1c20-414b-c239-ca4842957a41",
… … 
  "totalSize": 0,
  "totalCount": 0
}

Now the created version isn’t eligible to be deployed until we tell UCD we’ve finished.  If we look at the versions screen we will see something like this:

There is a new column ‘Is Importing’ that tells us that the version is not yet complete.

If we try to deploy our component we will see that we’re not even offered the incomplete version.

When we’ve finished creating our new version(s) we just execute the new udclient command finishedImporting to tell UCD we’re done

[root@localhost]# udclient --weburl https://localhost:8443 --username admin --password admin finishedImporting --component  'test component' -version 2.0 
Operation succeeded. 

I said earlier that we would touch on deployment triggers and how UCD has changed as of v7.1.0.  The old run a component process option in a components’ configuration has been replaced in favour of the new deployment triggers capability.  If you use these and are planning on upgrading, you should read this section in the documentation so that you are aware of the changes that will occur.

Starting with IBM UrbanCode™ Deploy version 7.1.0, deployment triggers replace the run process after a version is created feature.- UCD Knowledge Centre

The final discussion for this article is about a udclient command createManyVersions.  This command allows you to tell UCD how to import more than 1 version of a component in one go.  So this might be useful if you’re seeding a new component with historical versions that you might need.

However, it also allows you to setup links and statuses on the new version(s) in one go.  This command takes a JSON input file.

Interestingly, you can also use the command to create new versions of many components at one go as well.  So, if you have a build process that builds all your application components, then you could construct a JSON file and upload all of the new component versions in one udclient command:

[root@localhost]# udclient --weburl https://localhost:8443 --username admin --password admin createManyVersions manyVersions.json 
Operation succeeded.

If you have a lot of component versions to create, this can be significantly faster that using individual udclient commands to create the component versions and add links and statuses individually as you avoid the udclient startup overhead.

Here is an example JSON file I used in my example.  You can use the -t option on udclient commands that require JSON and it will provide you with a template to start editing.

[
  {
    "version": "New version 1",
    "componentName": "test component",
    "links": [
      {
        "name": "New link",
        "link": http://www.ibm.com
      }
    ],
    "status": [
      {
        "name": "CodeQualityCheck"
      }
    ]
  },
  {
    "version": "New version 2",
    "componentName": "my-other-test-component",
    "links": [
      {
        "name": "New link",
        "link": http://www.ibm.com
     }
    ],
    "status": [
      {
        "name": "CodeQualityCheck"
      }
    ]
  }
]

You do of course still have to add the files to each of the new component versions that you created.


Alan Murphy is an IBM services consultant who has worked with clients to help them adopt new tools and processes for the last 20 years. UrbanCode Deploy and DevOps has been his focus for the last 5 years. He also develops tools to assist clients in tool adoption and blogs on an occasional basis.

Tags: