metadata:
  name: gctsRollback
  description: Perfoms a rollback of one (default) or several commits
  longDescription: |
    This step performs a rollback of commits in a local ABAP repository. If a `commit` parameter is specified, it will be used as the target commit for the rollback.
    If no `commit` parameter is specified and the remote repository domain is 'github.com', the last commit with the status 'success' will be used for the rollback. Otherwise,
    `gctsRollback` will roll back to the previously active commit in the local repository.

spec:
  inputs:
    secrets:
      - name: abapCredentialsId
        description: ID taken from the Jenkins credentials store containing user name and password of the user that authenticates to the ABAP system on which you want to execute the rollback.
        type: jenkins
      - name: githubPersonalAccessTokenId
        description: GitHub personal access token with at least read permissions for the remote repository
        type: jenkins
    params:
      - name: username
        type: string
        description: User that authenticates to the ABAP system. **Note** - Don't provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
        secret: true
        resourceRef:
          - name: abapCredentialsId
            type: secret
            param: username
      - name: password
        type: string
        description: Password of the ABAP user that authenticates to the ABAP system. **Note** - Don´t provide this parameter directly. Either set it in the environment, or in the Jenkins credentials store, and provide the ID as value of the `abapCredentialsId` parameter.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
        secret: true
        resourceRef:
          - name: abapCredentialsId
            type: secret
            param: password
      - name: repository
        type: string
        description: Specifies the name (ID) of the local repsitory on the ABAP system
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
      - name: host
        type: string
        description: Protocol and host of the ABAP system, including the port. Please provide in the format `<protocol>://<host>:<port>`. Supported protocols are `http` and `https`.
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
      - name: client
        type: string
        description: Specifies the client of the ABAP system to be addressed
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        mandatory: true
      - name: commit
        type: string
        description: Specifies the target commit for the rollback
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
      - name: githubPersonalAccessToken
        type: string
        description: GitHub personal access token with at least read permissions for the remote repository
        scope:
          - PARAMETERS
          - STAGES
          - STEPS
        secret: true
        resourceRef:
          - name: githubPersonalAccessTokenId
            type: secret
