Class GitMaterial

All Implemented Interfaces:
Configurable, KeyVal.Mixin, Notifies.MaterialMixin, UtilsMixin

public class GitMaterial extends ScmMaterial<GitMaterial>
Represents a git material config.

/*
 * 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.
 */


  pipeline('docs-website') {
    materials {
      git {
        url = 'https://github.com/gocd/gocd'
        branch = 'develop'
        blacklist = ['README.md', 'docs/**']
        username = 'bob'
        // see https://api.gocd.org/current/#encrypt-a-plain-text-value
        encryptedPassword = 'aSdiFgRRZ6A='
      }
    }
  }

See Also:
  • Constructor Details

  • Method Details

    • dup

      Specified by:
      dup in class Material<GitMaterial>
    • getUrl

      public String getUrl()
      The url of the git repository.
    • getBranch

      public String getBranch()
      The git branch. Defaults to master.
    • getShallowClone

      public Boolean getShallowClone()
      Add a --depth=N option to git cloning command on GoCD agent. Shallow clone truncates history to latest revisions, thus helps accelerating clone operation for repositories with long history.

      Clone depth is dynamically calculated to ensure revisions from GO_FROM_REVISION to GO_TO_REVISION are included in the cloned repository.

    • setUrl

      public void setUrl(String url)
      The url of the git repository.
    • setBranch

      public void setBranch(String branch)
      The git branch. Defaults to master.
    • setShallowClone

      public void setShallowClone(Boolean shallowClone)
      Add a --depth=N option to git cloning command on GoCD agent. Shallow clone truncates history to latest revisions, thus helps accelerating clone operation for repositories with long history.

      Clone depth is dynamically calculated to ensure revisions from GO_FROM_REVISION to GO_TO_REVISION are included in the cloned repository.

    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ScmMaterial<GitMaterial>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ScmMaterial<GitMaterial>
    • toString

      public String toString()
      Overrides:
      toString in class ScmMaterial<GitMaterial>