java.lang.Object
cd.go.contrib.plugins.configrepo.groovy.dsl.Node<Approval>
cd.go.contrib.plugins.configrepo.groovy.dsl.Approval
All Implemented Interfaces:
Configurable, KeyVal.Mixin, UtilsMixin

public class Approval extends Node<Approval>
Specifies how a stage should be triggered. Approval of type 'manual' or 'success' can be used to stop a pipeline execution at the start of a stage and can only be resumed when it is manually approved on the pipeline activity page, stage details page or through RESTful url.

/*
 * Copyright 2022 Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


  stage('deploy') {
    approval {
      type = 'manual'
      allowOnlyOnSuccess = false
      users = ['bob', 'alice']
      roles = ['admins', 'deployers']
    }
  }

See Also:
  • Constructor Details

    • Approval

      public Approval()
  • Method Details

    • getType

      public String getType()
      The type of the approval, either 'manual' or 'success'
    • isAllowOnlyOnSuccess

      public boolean isAllowOnlyOnSuccess()
      Configuration to only allow stage to be scheduled if the previous stage run is successful.
    • getRoles

      public List<String> getRoles()
      The list of roles that are authorized to trigger
    • getUsers

      public List<String> getUsers()
      The list of users that are authorized to trigger
    • setType

      public void setType(String type)
      The type of the approval, either 'manual' or 'success'
    • setAllowOnlyOnSuccess

      public void setAllowOnlyOnSuccess(boolean allowOnlyOnSuccess)
      Configuration to only allow stage to be scheduled if the previous stage run is successful.
    • setRoles

      public void setRoles(List<String> roles)
      The list of roles that are authorized to trigger
    • setUsers

      public void setUsers(List<String> users)
      The list of users that are authorized to trigger
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Node<Approval>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Node<Approval>
    • toString

      public String toString()
      Overrides:
      toString in class Object