Compuware Test Drive Compuware DevOps Pipeline … Drive/Test...3 Getting Started with the Compuware...

of 52 /52
1 Compuware Test Drive Compuware DevOps Pipeline Tutorial (1/3/20)

Embed Size (px)

Transcript of Compuware Test Drive Compuware DevOps Pipeline … Drive/Test...3 Getting Started with the Compuware...

  • 1

    Compuware Test Drive

    Compuware DevOps Pipeline Tutorial (1/3/20)

  • 2

    Contents Getting Started with the Compuware Test Drive: DevOps Pipeline Tutorial .................................... 3

    Summary ........................................................................................................................... 3

    Use Case............................................................................................................................ 4

    ISPW ................................................................................................................................. 4

    Code Changes ....................................................................................................................... 8

    Generate (AKA Compile) ....................................................................................................... 22

    Promotion ........................................................................................................................... 23

    Review DevOps Pipeline Results ............................................................................................. 34

    Reviewing the results in SonarQube .................................................................................... 34

    Orchestrating the release in XebiaLabs XL Release ................................................................ 35

    Cleanup .............................................................................................................................. 49

    NEXT STEPS ........................................................................................................................ 52

  • 3

    Getting Started with the Compuware Test Drive: DevOps Pipeline Tutorial

    Summary

    The purpose of this Test Drive is to highlight the integration between Compuware ISPW, Compuware

    Topaz Workbench and Jenkins, enabling automated deployments through DevOps Continuous

    Integration. Learn about the modern Agile/DevOps features of ISPW as well as how developers can

    use its integration with Jenkins to:

    • Automate the download of source and its associated unit tests for testing using Compuware

    Jenkins plugins

    • Drive Continuous Integration processes with webhooks

    • Access and execute Topaz for Total Test assets for automated unit testing

    • Use test metrics in SonarQube Quality Gates and automatically regress failed code in ISPW to

    enable remediation

    • Automate orchestration of release deployment using XebiaLabs XL Release and ISPW APIs

    The following diagram illustrates a subset of the DevOps toolchain which this pipeline script

    accomplishes.

  • 4

    Use Case

    You will check out 3 programs to an ISPW assignment container, make a slight change to one of the

    subroutines and regenerate (recompile) all the modules. Once this is complete, the user will create an

    ISPW release container and transfer the 3 programs from the assignment container to this release

    container to be promoted to the next stage.

    Next, the user promotes the programs in the release container to the QA3 level. This action will trigger

    the Jenkins pipeline job behind the scenes via Compuware webhooks to download the program source

    and associated unit tests, execute the unit tests including code coverage data, and feed the execution

    results to SonarQube for analysis.

    If the “Quality Gate” passes, the programs are promoted to QA3 level and a XL Release is

    automatically created in the XebiaLabs XL Release product. The user, acting as release manager, can

    then orchestrate the release using the default workflow provided in XL Release. This orchestration,

    using the ISPW APIs, automatically promotes the programs to ISPW levels defined in the ISPW

    workflow, all the way to PRD level.

    ISPW

    Compuware ISPW enables developers to quickly and safely build, test and deploy mainframe code.

    This Test Drive script will take you through changing the source code, generating the code and

    promoting the code which will trigger program analysis in SonarQube.

    This Test Drive script will take you through the following activities:

    • Checking out the COBOL programs

    • Changing the code

    • Generating the code (aka Compiles)

    • Promoting the code into Test and Production environments

    • Feeding data into SonarQube from the COBOL Source, Unit tests and Code Coverage from

    Topaz for Total Test (TTT)

    • Orchestrating the release in production environment using XebiaLabs XLR product

    Instructions:

    • This guide contains many screenshots to provide a visual reference

    • Every action you must take is in BOLD

    • Please note each place that you must enter your own specific ID or number

    • You must complete each step before proceeding to the next to successfully follow the guide

    Note: At any point should you need to restart this Test Drive script, follow the instructions in the Cleanup

    section at the end of the script and then begin here

  • 5

    To get started in the Topaz Workbench:

    • Open the Host Explorer perspective

    • Click on the arrow next to Hosts,

    • Right-click on test-drive and select Login

    • Logon on with the user credentials that were provided to you for Test Drive and click

    OK

    • Select ISPW from the Compuware menu

  • 6

    During this Test Drive you will encounter terms specific to ISPW. Here is a glossary for your convenience.

    Terminology

    Term Description

    Application Business Area

    Stream Development Life-Cycle used by one or more Applications

    Life-Cycle Transitional Code States (DEV, QA, PROD) in the Development Life-Cycle

    Level Instance of a Code State (DEV, QA, PROD)

    Component SCM managed object such as a COBOL source member.

    Component Version An immutable version of a Component.

    Task An instance of a unit of work. For example, a change to a Component.

    Part A generated object such as a load module, or a Listing or a DBRM

    Warehouse Storage location for inactive historical or overlaid Component Versions (source and parts).

    Assignment Container A package of one or more, usually related, Tasks. A development container that is used to organize and

    manage development work.

    Release Container A package of Tasks from one or more Assignment Containers. An operational container that is used to

    organize and manage operational releases.

    Set Container A package of Tasks at an instance in time. A special ISPW container that is used internally to organize and

    manage work requests.

    Add Task Make a statement of intent, often because of some impact analysis.

    Checkout Task Copy source to development area

    Edit Task Make a change to the source in the development area.

    Generate Task Execute Compile and Link processes.

    Promote Task Move Task forward to the next Level in the Life-Cycle.

    Regress Task Move Task backwards to the previous Level in the Life-Cycle.

    Delete Task Remove a Task from the development area

    Fallback Task Restore previous version of Task.

    Deploy Task Implement Task in one or more Run Time environments.

  • 7

    Substitute your values in the screenshots In this Test Drive the screen shots provided have used specific values that may differ from your

    assigned values. These were provided in your email notice.

    While taking the Test Drive, you must substitute your assigned values!

    Variable Your Assigned Values

    Application Txxx*

    Assignment Prefix Txxx*

    * For the value of xxx, substitute the last three digits of your Test Drive username.

  • 8

    Code Changes

    Your development Task in this Test Drive is to add 3 COBOL programs—CWXTCOB, CWXTDATE,

    and CWXTSUBC—to an assignment container, make a change to either COBOL program

    CWXTDATE or CWXTSUBC, and generate and promote all 3 to the QA3 Level. To start this process,

    you will find and checkout the 3 COBOL programs into an ISPW Assignment from which you can

    perform all this work.

    1. Select the Stream CWEZ

    2. Select the Application to your assigned application value (Txxx, where xxx is your

    unique number)

    3. Select the Level to “PRD” and ensure the Level option is set to “Selected level

    only”

    4. Enter “CWXT*” in the “Name” field to filter the relevant components

    5. Filter the view even further by setting the Type to COB, this will allow you to focus

    only on the COB components available in your stream/application at the PRD level.

    Click Apply (circled)

    The ISPW Repository View lists the COB Components for your application.

    Use your assigned values.

    See instructions above

  • 9

    Select CWXTCOB, CWXTDATE, and CWXTSUBC, then right-click and select “Add to

    Assignment with Check Out…”

  • 10

    From the Add Task dialog box, select NEW to the right of Assignment. This will allow you to

    create a new Assignment Container to put your COBOL programs into.

  • 11

    For Stream, use CWEZ. For Application and Assignment prefix, use your assigned values

    (see “Substitute your values in the screenshots”). Select a Default Path of DEV3 and provide

    a description for your Assignment.

    Click OK.

    Note: DEV3 is one of paths defined to this application which the Components can take to Production.

    A picture of the Life-Cycle will be provided further along the Test Drive.

  • 12

    A message will be displayed providing you with your new Assignment name.

    Make note of the Assignment name. Click OK.

    Your new Assignment has been created and is ready to have Tasks added to it. An Assignment

    Container is the only Container Type in ISPW that Tasks can be added to. The Assignment Container is

    where a developer will spend much of their time.

  • 13

    If your new assignment name does not appear in the Assignment field, select it from the

    drop-down box. Select DEV3 for the Path

  • 14

    Click OK.

  • 15

    Messages will be displayed to inform you that the tasks have been added to your Assignment and

    checked out to the DEV3 level. You have added your first Tasks to your Assignment.

    Click OK.

  • 16

    The new container will be listed in the ISPW Containers view.

    Click on the link on the container name to open the ISPW Tasks View.

    This will list the tasks added to the container.

  • 17

    Every operation that needs to be performed on these Tasks and other Components which are impacted

    by changing these Tasks (edit, impact analysis, compile, promote, deployment etc..) can be performed

    from this Assignment view.

    Note that the COBOL Tasks in the Assignment are checked out and sitting in the DEV3 level. The

    checkout date/time and userid is reflected in the Tasks information.

    At checkout, a destination level for the checkout was chosen – DEV3.

  • 18

    To see the ISPW Life-Cycle path structure that was constructed for the Application, Click

    once on the Task and then Click on the View Life-cycle icon.

  • 19

    A picture of the Life-Cycle is presented. You will notice the levels containing Versions of the

    highlighted Tasks are colored indicating the existence of a version of that Component at those levels.

    From this picture it is very easy to visually see where all versions exist. By choosing the DEV3 Level,

    you have defined the Path to Production → DEV3-QA3-STG-PRD. Other versions of these Components

    may also exist at other levels and may be passing through the other three paths – FIX, DEV1, or

    DEV2.

    Four paths were created for the application – one for emergencies starting at level FIX and three for

    development starting at DEV1, DEV2, and DEV3. The application level structure is customizable when

    defining the applications to ISPW. Any number of paths can be defined with a minimum of three

    Levels.

  • 20

    Now that you have Versions of the COBOL programs the next step would be to make your changes.

    To do this right-click on CWXTDATE and select Open or simply double-click on it.

    The version’s source will be presented for editing.

    Edit a comment line (ensure you do not “break” the COBOL program).

  • 21

    Once you have made a change, close the Editor view. Click Yes to save the changes.

    Note the Operation, date/time and User ID fields have been updated to reflect the change in the Task

    status.

  • 22

    Generate (AKA Compile)

    The COBOL programs will be generated/compiled, and your Assignment Task List will be updated to

    reflect the new status.

    • The Operation will be Generate

    • The User ID, Date/Time will be updated

    • The Message will be updated to reflect the successful completion of the generate

    Select all 3 COBOL programs and right click and select generate. The programs will be

    compiled. There are some deliberate errors in these programs so that you can view them later in

    SonarQube.

    Upon successful Generate, the Operation field in the Tasks view will say “Generate”

  • 23

    Promotion

    At this point you have

    • Created an Assignment

    • Checked out 3 COBOL programs to the Assignment

    • Edited 1 of the COBOL programs

    • Generated all 3 COBOL programs

    Now you are ready to promote your changes to the QA3 level. Once everything has been generated

    successfully you will now promote the 3 components together to the next level, QA3.

    Create a new Release container

    1. Click on ISPW Containers view

    2. Click on “New Release” button on the far right of the “containers” view

    3. In the “Add New Release” popup dialog, enter the values for the following fields:

  • 24

    a. Release ID

    b. Description

    c. Click OK

    Note: If you need to repeat this Test Drive script again, you can create new Release containers

    with incremental suffix value (Ex. CWEZXXXR1, CWEZXXXR2, etc.)

    You will see a dialog box indicating that your release container was successfully created. Click OK

    4. The newly created Release container shows up in the Containers list:

  • 25

    Transfer Task from Assignment to Release container

    You need to transfer the 3 tasks from Assignment container to the newly created Release container.

    1. Open the Assignment container (created earlier), select the 3 tasks, right-click, select

    “Transfer Task” option

  • 26

    2. In the “Transfer Task” popup window, select the newly created Release container. Click OK.

  • 27

  • 28

    3. Click on the ISPW Containers view, then click on the link for your release container.

    Now, all 3 tasks should show up in the Release container

    Select all 3 components, right-click and select promote.

  • 29

    This action will create a Set Container. Sets are a special category of containers within ISPW that are

    used to conduct operations such as promotion and deploy. They are temporary and created by ISPW

    as needed for the work. This allows you to promote subsets of Tasks within an Assignment container

    without the need to act on all the Tasks at once.

    Once you click Promote, the Task you selected was placed in a SET container for the promotion.

    The ISPW Set processor will:

    • Perform the promotions of all the source to QA3

    • Cleanup the DEV3 level (source and parts if applicable)

    • Deploy to runtime environments (if required)

    Please click refresh to watch for the promotion of the modules.

  • 30

    At this time, a message box appears with successful promotion.

  • 31

    Click OK

    As the Task in the SET is being processed you can monitor the progress by Clicking the refresh

    button.

    In the screen shot below you can see the promotion has finished – the Tasks have been promoted to

    QA3 (see the Level value and the Operation in the Task List as well as the highlighted Level in the

    picture). Note the Operation of the programs reflects a Generate as the last operation. The SET

    processor performed a promotion and then a generation as ISPW recognized a generate was required

    for COB types at the QA3 level based on the configuration of this application.

  • 32

    Congratulations! You have successfully promoted your application to QA3.

    Upon successful promotion, a pre-configured Compuware Enterprise Services (CES) webhook will

    trigger a Jenkins pipeline which will download the COBOL source and Topaz for Total Test (TTT) project

    for the application, execute the unit tests with code coverage options and send the source code, unit

    test results along with code coverage data to SonarQube for analysis. The SonarQube analysis will

    show where any errors may still exist in the code you are promoting as well as unit test and code

    coverage results.

    The Jenkins pipeline, as a last step, also creates XebiaLabs XL Release (from a pre-defined Release

    Template) for a Release Co-Ordinator/Manager to orchestrate the release all the way to Production

    level in ISPW.

    This is all performed as a background process. When you see the modules promoted to QA3, you may

    continue to the next step.

    The screenshot below shows the Jenkins pipeline Stage View.

  • 33

    To watch the progression of your Jenkins pipeline build, do the following:

    • In Topaz, click on “Run➔External Tools➔Chrome” in the menu bar to launch Chrome

    browser externally. Chrome Opens with multiple tabs.

    • Click on “Jenkins” browser tab

    You can watch your Jenkins pipeline build kicking off.

  • 34

    Review DevOps Pipeline Results

    Reviewing the results in SonarQube

    • In Topaz, click on “Run➔External Tools➔Chrome” in the menu bar to launch Chrome

    browser externally (If not opened already). Chrome Opens with multiple tabs.

    • Click on “SonarQube” browser tab

    When the SonarQube home page is displayed, enter your Test Drive userid in the “Search for

    projects…” field on top-right corner, then press enter.

    Click on the project name from the results

    This provides a simple and automated way to ensure that your code is being tested and analyzed for errors

    before it is promoted to production.

  • 35

    Orchestrating the release in XebiaLabs XL Release

    Let us assume all the testing at the QA3 level has been successfully completed and you are ready to

    promote to the STG level and, eventually, to the PRD level.

    The DevOps Pipeline job has also created a new release instance in XL Release product, based on a

    pre-defined XL Template. From here on, a Release Manager/Co-Ordinator can orchestrate the release,

    in XL Release, to promote it from QA3 level onto STG and, eventually, to PRD levels in ISPW.

    The newly created XL Release for this DevOps run can be accessed by doing the following steps:

    • In Topaz, click on “Run➔External Tools➔Chrome” in the menu bar to launch Chrome

    browser externally (If not opened already). Chrome Opens with multiple tabs.

    • Click on “XL Release” browser tab

    XL Release will pop up a login dialog:

    • Enter your Test Drive username as user (Ex. CWEZXXX)

    • Enter your Test Drive username + “_XLR” suffix for password (Ex. CWEZXXX_XLR)

    You will be taken to the “Releases” section of XLR dashboard

  • 36

    Click on “My Releases” button on the dashboard to retrieve user’s releases

    Click on the latest release to open

    The release has 2 phases: QA Environment and Production Environment.

    The Release Manager orchestrates the release in the QA environment when promoting from QA3 to

    STG levels and production environment when promoting from STG to PRD levels.

  • 37

    Orchestration in QA Environment

    Start the workflow by assigning the task to yourself by clicking on the “Assign to me”

    option of the “Ready for Stage” workflow step (by clicking on the 3 dots icon):

  • 38

    Next, complete the task by selecting “Complete” option of the step

    Upon clicking “complete”, the workflow will prompt to enter a comment before commencing with next

    automated step of the workflow, which promotes the release from QA3 level to STG level using ISPW

    REST APIs.

    Enter a comment and click Complete.

  • 39

    At this point, you can switch back to Topaz Workbench to monitor the ISPW lifecycle view by clicking

    on “Refresh” button (circled).

    Notice that the code is now promoted to STG level via the ISPW REST APIs invoked from XL Release.

  • 40

    Next, expand “Accept Code promotion to Stage” workflow step and select “Complete”

    option on the “Wait for Promote” step within it to complete the step:

  • 41

    The workflow prompts to enter a comment. Enter comment and Click Complete.

  • 42

    Finally, to complete the orchestration of QA Environment of the workflow, assign the step to yourself,

    mark it complete and enter a comment. Click Complete.

  • 43

    At this point, the workflow proceeds to the Production Environment phase.

  • 44

    Orchestration in Production Environment

    Upon successful completion of the Workflow steps in QA Environment, the workflow next proceeds to

    automatically promote the release to PRD level by invoking the ISPW REST APIs.

  • 45

    Switch back to Topaz Workbench to monitor the ISPW lifecycle view by clicking Refresh

    button (circled).

    Notice that there is now a “check” icon in the STG level box. It indicates that user needs to take

    further action to promote code from this level.

    Open the ISPW Life Cycle View

    Right-click on the icon and select “Approve” option to approve the request

  • 46

    Once again, click Refresh (circled) to refresh the lifecycle view. Notice that the code is now

    promoted all the way up to PRD.

  • 47

    Finally, to complete orchestration of Production Environment in XL Release, select

    “complete” option in the “Wait for Promote” step and enter a comment. Click Complete.

  • 48

    After successfully completing the XL Release workflow, click on “Refresh” on the ISPW

    Lifecycle view in Topaz to see that the tasks have been promoted and deployed to PRD level

    Click the Refresh button (as indicated in the screenshot)

    You can see in the updated screen below that

    • SET processing has begun

    • The COBOL programs have been processed for a Promotion and are now at the PRD level

    The Promotion and deployment to the PRD level has completed. The source and parts for the COBOL

    programs were moved to the PRD level Life-Cycle libraries and the STG level libraries were cleaned up

    as appropriate.

  • 49

    Cleanup

    As a Developer you are now finished with your Assignment, so it can be closed. Assignments must be

    closed manually and are usually closed to declutter the ISPW Container List View.

    To Close the Assignment first Close the “ISPW Tasks” View by clicking on the “Close

    Window” button.

  • 50

    To Close your Assignment, Right Click on your Assignment and select “Close”.

  • 51

    A Close confirmation panel is presented.

    Click OK to complete the Close.

    Closed Assignments, Sets and Releases are never deleted from ISPW. They are just filtered out of the

    standard day-to-day filtering.

    Once an Assignment, Set or Release is closed it is removed from the standard filtered list, but it is still

    part of ISPW history and can be viewed at any time.

    Note: If you need to repeat this Test Drive script again, you can either reuse the Release container

    already created or create new Release containers with incremental suffix value (Ex. CWEZXXXR1,

    CWEZXXXR2, etc.)

  • 52

    You are done! Your job has been to change a COBOL program. As a part of this exercise, you have

    been able to use Compuware’s Topaz Workbench and ISPW to:

    • Create an Assignment and Release container

    • Add and check out 3 COBOL programs

    • Change one program using Topaz Editor

    • Promote the COBOL programs from DEV3 to QA3

    • Trigger a DevOps Pipeline script in Jenkins (via CES Webhook) which does the following:

    o Download a feed into SonarQube COBOL Source, Unit tests and Code Coverage results

    from TTT

    o View and analyze SonarQube results

    o Use XebiaLabs XL Release to orchestrate a release in ISPW

    o Promote the COBOL programs from QA3 to STG (using XL Release)

    o Promote the COBOL programs from STG to PRD (using XL Release)

    • Closed your Assignment to complete the change cycle

    Congratulations! This completes the DevOps Pipeline tutorial for Compuware Test Drive.

    NEXT STEPS

    Should you wish to restart this Test Drive script, follow the restart instructions at the beginning of this script.

    Click on the link below to return to the Compuware Test Drive main page and choose your next road

    trip!

    COMPUWARE TEST DRIVE

    https://compuware.com/test-drive/