Trigger DEMOTE outside the mainframe using Jenkins Pipeline

Hello,

We are able to trigger the demote process by using the Skeleton inside the mainframe without issue. However, application team would like We have a User that is looking to create a Jenkins pipeline that will be initiated by a Package Promote on ZMF. The pipeline will execute a test off-mainframe and if the results are bad, they wish to initiate a Package Demote from the same pipeline. We know how to post an event from the mainframe via skeletons, but how does this work in the other direction.

We are looking for code examples to execute the Package Demote(or any REST service) from a Jenkins script.

Thank you!

David

Labels:

ChangeMan ZMF
Parents
  • Verified Answer

    +1  

    Are you familiar with zowe cli and the ChangeMan ZMF plugin for zowe cli?

    Using that, you can issue a ZMF zowe cli command to perform your Package Promote/Demote from within Jenkins within a python script or whichever scripting language you are using.

    Here is a very simple sample Python script that demonstrates how to issue the ZMF cli commands to: 

    1) retrieve a component from a package and place the retrieved source into a local folder by piping the output into that folder.

    2) retrieve the list of copybook files associated with the component

    3) for each copybook, parse the returned json and retrieve that copybook's source and pipe into the same folder as the component source. 

    4) delete the folder that was created to hold the json response



    All ZMF cli commands for zowe follow the same format.

  • 0 in reply to   

    Hi  ,

    I've tried some of these functions but I got some problems. As an example:

     

    zowe zmf get cbp -h
    Command Error:
    Unknown argument: cbp
    Command failed due to improper syntax
    Did you mean: zmf get cbd?

    Command entered: "zmf get cbp -h"
    Available commands are "baseline, component, component-browse-dependencies, history-concurrent, history-current, history-language, component-load, component-source-include, component-source-include-locate, component-source-include-no-locate, dss, libtype-appl, library-baseline, log, package-search, package-genparms, libtype-package, parameters-appl, parameters-global, reasonscodes, restversion, site-appl, system-environment, zmf-environment".
    Use "zowe zmf get --help" to view groups, commands, and options.
    Error Details:
    Unknown argument: cbp

    So I've tried with the commands I've got in the list and I may get the source code using

    zowe zmf browse pcomp -c "mycomponent" -t "mytype" -p "mypackage"

    So I don't get if this sample is too old or too new for me: I've microfocus-zmf-cli-plugin-2.0.5.tgz

    Could you please explain?

    Thank you very much.

  • Suggested Answer

    0   in reply to 

    A full and complete list of available commands can be found by issuing a

    zowe --hw  command

    An example to retrieve a component from a package would be:

    zowe zmf get component -p STEV001571 -t SRC -c ASMPGM33

    or more simply

    zowe zmf get component -p STEV00157 

    will retrieve all

  • 0 in reply to   

    Thank you   but with "get component" I get the "informations" about the source:

    I mean I get something like this

    zowe zmf get component -c "PYTCX001" -t "COB" -p "BKA 000435" --zmf-profile "zmfx"
    {
    "message": "CMN8700I - LIST service completed",
    "reasonCode": "8700",
    "returnCode": "00",
    "result": [
    {
    "applName": "BKA",
    "batchChkOut": "N",
    "buildProc": "COBB00",
    "checkedOutHashToken": "EB8E531000001A3A",
    "chkOutComponentDesc": "N",
    "chkOutFromBaseLib": "N",
    "chkOutFromRelease": "N",
    "chkOutLevel": 0,
    "chkOutToSernet": "N",
    "chkOutToStageLib": "Y",
    "component": "PYTCX001",
    "componentStatus": "0",
    "componentType": "COB",
    "dataType": "1",
    "dateLastEdited": "20240409",
    "dateLastEditedUtc": "20240409",
    "dateLastModified": "20240409",
    "dateLastModifiedUtc": "20240409",
    "editTsoid": "UANTS",
    "hashToken": "909FEA7800001AEB",
    "language": "COBOLE",
    "lockComponent": "N",
    "modLevel": 2,
    "package": "BKA 000435",
    "packageId": 435,
    "recordType": "A",
    "setssi": "78E54F67",
    "sourceLib": "TCML.CHA000.STBKA.#000435.COB",
    "sourceLibOrg": "PDS",
    "targetComponent": "PYTCX001",
    "targetLoadLibType": "LOB",
    "timeLastEdited": "145904",
    "timeLastEditedUtc": "125749",
    "timeLastModified": "145954",
    "timeLastModifiedUtc": "125954",
    "updater": "UANTS",
    "version": 1

    So for getting source code for me works

    zowe zmf browse pcomp  -c "PYTCX001" -t "COB" -p "BKA 000435" --zmf-profile "zmfx"

    Reading changes in cli plugin I think that the line in the sample in this discussion

    command = f"zowe zmf get cbp -c {comp} -t {type} -p {package} --zmf=p {zmf} > S:/projects/mainframe/zmf_test/{comp}.{type}"
    is an old function that actually has a new name (browse pcomp I think).
    Is it correct?
  • 0   in reply to 

    They are 2 different functions:

Reply Children