github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/documentation/docs/steps/transportRequestReqIDFromGit.md (about)

     1  # ${docGenStepName}
     2  
     3  ## ${docGenDescription}
     4  
     5  !!! note "Executed on Jenkins Master"
     6      This step is executed on the Jenkins master only. On the master node the project's Git repository is fully available. If kubernetes is used, the Git repository would have to be stashed. Depending on the size of the repository, this would be quite expensive or not possible at all.
     7  
     8  ## Administering the Transport Request ID by Git Commit Messages
     9  
    10  The `transport request ID` identifies a container in the ABAP development system that can be used to document and transport changes within the landscape.
    11  If you upload your pipeline artifacts into such a container, please provide the transport request ID in an upload step.
    12  See [transportRequestUploadSOLMAN](transportRequestUploadSOLMAN.md).
    13  
    14  With `transportRequestReqIDFromGit`  you can retrieve the transport request ID from the commit message of the Git repository of your project. This way, you can address the transport request without having to change the setup of your pipeline.
    15  Please make sure that the ID is unique in the defined search range.
    16  
    17  ## General Purpose Pipeline Init Stage
    18  
    19  The step can also be configured via General Purpose Pipeline in Init stage using the config.yml as follows:
    20  
    21  ```yaml
    22  stages:
    23    Init:
    24      transportRequestReqIDFromGit: true
    25  ```
    26  
    27  This will initialize the step within the Init stage of the pipeline and retrieve the `transportRequestId` from the git commit history.
    28  
    29  ### Specifying the Git Commit Message
    30  
    31  `transportRequestReqIDFromGit` searches for lines that follow a defined pattern in the Git commit messages (`git log`) of your project.
    32  Only if necessary, specify the pattern with the label _transportRequestLabel_ (default=`TransportRequest`).
    33  Behind the label, enter a colon, blank spaces, and the identifier.
    34  
    35  ```
    36  Upload - define the transport request ID
    37  
    38      TransportRequest: ABCD10005E
    39  ```
    40  
    41  ### Specifying the Git Commit Range
    42  
    43  The Git commit messages to be considered are determined by the parameters _gitFrom_ (default=`origin/master`) and _gitTo_ (default=`HEAD`).
    44  The naming follows the Git revision range notation `git log <gitFrom>..<gitTo>`.
    45  All commit messages accessible from _gitTo_ but not from _gitFrom_ are taken into account.
    46  Choose the commit range accordingly, as the detection of multiple IDs causes the scan to fail.
    47  
    48  Keep the default values `HEAD` and `origin/master` in case you want to retrieve the ID within the scope of a pull request.
    49  The default values should be sufficient provided that
    50  
    51  * you commit the transport request ID into the pull request
    52  * you do not merge the `origin/master` before the scan
    53  * you do not change the transport request ID while developing
    54  
    55  This way, only the commits (`HEAD`) that have not yet entered the main branch `origin/master` are scanned.
    56  
    57  ```
    58  o 3d97415 (origin/master) merged last change
    59  |
    60  | o d99fbf7 (HEAD) feature fixes
    61  | |
    62  | o 5c380ea TransportRequest: ABCD10001E
    63  | |
    64  | o 0e82d9b new feature
    65  |/
    66  o 4378bb4 last change
    67  ```
    68  
    69  If you want to retrieve the ID from the main branch, be aware that former transport request IDs may already be in the history.
    70  Adjust _gitFrom_ so that it points to a commit before your ID definition.
    71  
    72  ```yaml
    73  steps:
    74    transportRequestReqIDFromGit:
    75      gitFrom: '4378bb4'
    76  ```
    77  
    78  ```
    79  o 3d97415 (origin/master) merge new feature
    80  |
    81  o d99fbf7 feature fixes
    82  |
    83  o 5c380ea adjust config.yaml
    84  |           TransportRequest: ABCD10001E
    85  |
    86  o 0e82d9b new feature
    87  |
    88  o 4378bb4 merged last change
    89  ```
    90  
    91  Define _gitTo_, if it cannot be ruled out that further transport request IDs have been merged in parallel.
    92  
    93  ```yaml
    94  steps:
    95    transportRequestReqIDFromGit:
    96      gitFrom: '4378bb4'
    97      gitTo: 'd99fbf7'
    98  ```
    99  
   100  ```
   101  o 3d97415 (origin/master) merge new feature
   102  |\
   103  . o d99fbf7 feature fixes
   104  . |
   105  . o 5c380ea adjust config.yaml
   106  . |           TransportRequest: ABCD10001E
   107  . |
   108  . o 0e82d9b new feature
   109  |/
   110  o 4378bb4 merged last change
   111  ```
   112  
   113  ## ${docGenParameters}
   114  
   115  ## ${docGenConfiguration}
   116  
   117  ## ${docJenkinsPluginDependencies}
   118  
   119  ## Example
   120  
   121  ```groovy
   122  transportRequestReqIDFromGit( script: this )
   123  ```