All Implemented Interfaces:
Configurable, KeyVal.Mixin, UtilsMixin, Iterable<Task>, Collection<Task>, List<Task>

public class Tasks extends CollectionNode<Task>
Represents a collection of tasks.
  • Constructor Details

    • Tasks

      public Tasks()
  • Method Details

    • exec

      Creates an `exec` task.
    • shell

      Convenience for exec(Closure) task that wraps a command in a shell.

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


        tasks {
          // for simple evaluation of environment variables
          // equivalent of `bash -c 'rsync file user@${REMOTE_HOST}:'`
          bash {
            commandString = 'rsync file user@${REMOTE_HOST}:'
          }

          // to explicitly call a shell script using `bash deploy.sh`
          bash {
            file = "./deploy.sh"
          }

          // to load up `.profile` or equivalent. This is particularly useful if you're using shell shims like `rvm` or `nvm`
          bash {
            login = true
            // you can also invoke the following method:
            loadProfile()
          }

          // if you want to use a custom shell
          shell {
            shell = '/bin/fish'
            file = './deploy.sh'
          }
        }

    • bash

      Convenience for exec(Closure) task that wraps a command in a bash shell.

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


        tasks {
          // for simple evaluation of environment variables
          // equivalent of `bash -c 'rsync file user@${REMOTE_HOST}:'`
          bash {
            commandString = 'rsync file user@${REMOTE_HOST}:'
          }

          // to explicitly call a shell script using `bash deploy.sh`
          bash {
            file = "./deploy.sh"
          }

          // to load up `.profile` or equivalent. This is particularly useful if you're using shell shims like `rvm` or `nvm`
          bash {
            login = true
            // you can also invoke the following method:
            loadProfile()
          }

          // if you want to use a custom shell
          shell {
            shell = '/bin/fish'
            file = './deploy.sh'
          }
        }

    • zsh

      Convenience for exec(Closure) task that wraps a command in a zsh shell.

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


        tasks {
          // for simple evaluation of environment variables
          // equivalent of `bash -c 'rsync file user@${REMOTE_HOST}:'`
          bash {
            commandString = 'rsync file user@${REMOTE_HOST}:'
          }

          // to explicitly call a shell script using `bash deploy.sh`
          bash {
            file = "./deploy.sh"
          }

          // to load up `.profile` or equivalent. This is particularly useful if you're using shell shims like `rvm` or `nvm`
          bash {
            login = true
            // you can also invoke the following method:
            loadProfile()
          }

          // if you want to use a custom shell
          shell {
            shell = '/bin/fish'
            file = './deploy.sh'
          }
        }

    • fetchArtifact

    • fetchExternalArtifact

    • fetchFile

    • fetchDirectory

    • plugin

    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<Task>
      Specified by:
      equals in interface List<Task>
      Overrides:
      equals in class CollectionNode<Task>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<Task>
      Specified by:
      hashCode in interface List<Task>
      Overrides:
      hashCode in class CollectionNode<Task>