Automated Deployment of IICS assets - Continuous Integration using the IICS Asset Management CLI and Jenkins Pipeline

Version 9

     

    Overview

     

    In this document, we will demonstrate how to leverage the IICS Asset Management CLI v2 utility to integrate your Informatica Intelligent Cloud Services development environment with Version Control System (VCS) and perform Continuous Integration (CI). Continuous Integration (CI) is a development practice where developers integrate code into a shared repository frequently, preferably several times a day. Each integration can then be verified by an automated build and automated tests.

     

    We will demonstrate how one can:

    • Checkout assets from the Git repository
    • Package them into a single export ZIP file that is compliant with IICS export format
    • Import the assets into IICS
    • Publish these assets (wherever applicable e.g. Taskflows, Cloud Application Integration Process/Guides/Connection/Service Connectors)

     

    for performing automated restore of versions, a CI activity. The same techniques can be used to restore deployments to test and pre-production environments also.

     

    The utility is available for various operating system of your choice and is broadly applicable to all IICS services. You may also want to refer IICS Asset Management CLI V2 Utility: Command Reference Guide to the utility to know more options available with the utility.

     

    Additional Resources

    Please refer Automated Backup of IICS Assets - Continuous Integration using IICS Asset Management CLI and Jenkins Pipeline  to know more about how one can use IICS Asset Management CLI v2 along with Jenkins Pipeline to perform:

    • List IICS assets from the IICS environment based on query filters
    • Export these assets into a single ZIP file
    • Extract these assets into IICS-like Project/folder hierarchy
    • Checkin (Push) to Version Control System (Git in this example)

     

    Video Sample

     

    This video demonstrates how to use the IICS Asset Management CLI v2 in a Jenkins Pipeline to perform Continuous Integration.

     

     

    Do you want to try this for yourself?

     

    After watching the video, I am sure you would be excited to try this out yourself. Why not?

    Please follow below steps and create your own version of CI/CD.

     

    Setup Jenkins Pipeline

     

    Prerequisite: You need to have access to Jenkins server.

    Create a new Jenkins Pipeline and give it an appropriate name.

     

    Note: You may want to reuse the Title "Restore assets from Git based on Release Version" and Description "In this Project, user will provide the user details of the org, release tag that will be used to fetch assets from Git and the Git access details. With this information, this pipeline will checkout the list of assets based on the provided release tag, from the Git for which details are provided, package them into an import zip and import them into IICS." for the attached script as Title and description for your script as well.

     

    Setup Integration between Jenkins and Git

     

    You will need to perform below steps (in the same order) to ensure that Jenkins is able to access Git repository:

     

    • Download Git command line and set it up on the machine where Jenkins is running
    • Put the git.exe in the SYSTEM PATH e.g if git.exe is in C:\Program Files\Git\cmd, you need to put C:\Program Files\Git\cmd in the PATH
    • Go to Jenkins -> Manage Jenkins -> Global Tool Configuration and enter Path to Git executable to git.exe as shown below.

    • Restart Jenkins Service
    • Use SSH Git repository access. You will need to use this URL while trying to access Git repository from Jenkins

    • Generate SSH key where Jenkins Server is running. Follow below steps:

    • Configure the Jenkins Service to run with the user account, copy this private key into C:\Users\<username> as id_rsa and restart Jenkins

     

    Setup credentials in Jenkins

     

    You will need to create Credentials in Jenkins through Jenkins -> Credentials -> System -> Global credentials (unrestricted) -> Add Credentails to ensure that the authentication details are secure and not exposed to the user looking at logs. We need to define four Credentials (used in the sample script)

     

     

    • jenkins_ssh_key: This is needed to ensure that Git is able to access the Jenkins server running on a local machine using private key.
      • Create a credential with Kind as SSH Username with private key
      • ID should be jenkins_ssh_key
      • Username should be the GitHub username
      • Copy the contents of private key generated with the ssh-keygen command earlier into the Private Key section as given below:

    • prod_login: This is needed to login to Production environment and export / import assets.
      • Create a credential with Kind as Username with password
      • Username should be the IICS Production environment username that you would want to access
      • Password should be the IICS Production environment password that you would want to access
      • ID should be prod_login

    • dev_login: This is needed to login to Development environment and export / import assets.
      • Create a credential with Kind as Username with password
      • Username should be the IICS Development environment username that you would want to access
      • Password should be the IICS Development environment password that you would want to access
      • ID should be dev_login

    • qa_login: This is needed to login to QA environment and export / import assets.
      • Create a credential with Kind as Username with password
      • Username should be the IICS QA environment username that you would want to access
      • Password should be the IICS QA environment password that you would want to access
      • ID should be qa_login

     

    Download the Pipeline script

     

    Sample Jenkins Pipeline script is attached. Please copy this under the Pipeline section:

     

     

    Setup Input Parameters

     

    As you would have noticed, this script need user inputs.

    Please edit the Pipeline and mark this Project as Parameterized.

     

     

    Please setup below inputs:

     

    • Choice Parameter: TargetDetails - Which environment do you need to deploy the assets to?

    • Choice Parameter: GitStore - Which Git repository you want to use for Version Control?

    • String Parameter: ReleaseVersion - What is your (release) filter criteria for the assets that need to be version Controlled?

    • String Parameter: GitWorkspace - What is your local Git Workspace where the assets be persisted locally?

     

    • In addition, you will also need to modify the script:
      • utilHome: This should be set to the directory where the asset management CLI v2 iics.exe is downloaded
      • exportZIP: Create this directory under utilHome. This is where the assets would be exported

     

    • You will also need to setup the artifactsFile that are needed for package and publish commands. You can do it in two ways:
      • Use the List command on Source IICS environment to get the list of the assets with the Project/Folder hierarchy in the format artifactsFile is being used by the Utility.
      • Create it manually

     

    File contents should be of the format:

     

    Examples:

    Explore/ProjectName/FolderName/<MyProcess>.PROCESS

    Explore/ProjectName/<MyConnection>.AI_CONNECTION

    Explore/ProjectName/<MyFolderName>.Folder

    Explore/<MyProjectName>.Project/

     

    You can define multiple paths. Separate entries with a space character.

     

    Also, ensure that these assets are listed with dependencies and then the dependents in the right order. This sequence is needed for a successful publish operation. If you do not perform publish on the assets, you do not have this requirement

     

    Please refer embedded video for more details.

     

    Execute the pipeline

     

    To execute the pipeline, just execute the Project with "Build with Parameters" and provide user inputs.

     

     

    You should be able to see the status of execution in various stages as given below:

     

     

    In case of failures (or otherwise), you can look at logs for each stage of execution.