Cloud customer?
Start for Free>
Upgrade in MyJFrog >
What's New in Cloud >





Overview

Pipelines enables creation of user-defined resources to extend the Pipelines DSL.


2022世界杯阿根廷预选赛赛程 typically contain information needed for a s tep in a pipeline to execute and can also be used to store information produced by a step.

Extension resourcesenable Pipelines users to extend the Pipelines DSL by specifying their own resource types. When loaded into Pipelines, these user-defined resources can be used in any pipeline just like any other resource in the Pipelines DSL.In this way, teams and organizations can create and share their own re-usable, custom resource types for frequently used information in their pipelines.

Extension resources are defined within a namespace, to ensure that all resources in the set have unique names.

Extension resources are versioned, and can be invoked in pipelines by their semantic version number to ensure compatibility.

Page Contents


Files

Extension resource definitions must be stored in a subdirectory path of the form:resources/<namespace>/.

  • namespaceis the namespace for the set of extension sets. This parent subdirectory may contain multiple step definition subdirectories.
  • resourceTypeNameis the namedtypeof resource. Must be alphabetic characters only, and is case-sensitive.The subdirectory can hold the following files to define the resource.
File Description Required/Optional
resourceModel.yml Syntax modelfor the resource. Required

onInput.sh

and/or

onInput.ps1

Shell scriptto execute when named in a step'sinputResources. Optional

onOutput.sh

and/or

onOutput.ps1

Shell scriptto execute when named in a step'soutputResources. Optional
ReadMe.md Documentation for the custom resource. Optional
icon.svg

Icon graphic to represent the resource type in the interactive diagram.

If not provided, Pipelines will use the default icon for the resource.

Optional

Extension resrouce definitions are loaded from the source repository when it is configured in the Pipelines UI as an extension source.

For information on administering extension sources and extension version lifecycle staging, seeManaging Pipelines Extensions.


Syntax Model

这是语法模型资源。

resourceModel.yml
description:  # User can provide an optional description platforms: # optional - os: Linux - os: Windows configuration: # array of properties : type:  # required required:  # optional immutable:  # optional: field value cannot/can be changed validate: # optional  allowedIntegrationTypes:  # optional # more property definitions userDefinedDataType: # array of data type definitions - type:  # Defines a new data type configuration: - : # Specifies a property of the data type type:  # required required:  # optional validate: # optional  allowedIntegrationTypes:  # optional # more data type property definitions

Tags

You can define the following tags in theresourceModel.ymlfile.

description

A user-friendly description of the resource's function that will be available for display in the Pipelines UI. This is optional.

platforms

Defines the operating system for the node. Linux and Windows operating systems are supported.

This tag is optional and Linux is the default operating system when this tag is not specified.

Tag Description of usage Required/Optional
os Specifies the operating system. Linux and Windows are supported. Optional
os Examples
platforms: # optional - os: Linux - os: Windows

configuration

Begins a block of property definitions. Each property definition begins with the name of the property (letters only, case-sensitive), followed by these subordinate tags:

Tag Description of usage Required/Optional
type Specifies an inbuilt or user-defineddata type. Required
required

When set as真正的, specifies that the property is mandatory.If no value is provided, pipeline sync will fail.

Default isfalse.

Optional

不可变的

When set to真正的, the field cannot be changed from its initial value. Optional
validate Begins avalidation specificationblock. Optional
配置示例
configuration: gitProvider: type: Integration required: true immutable: true # Once the resource is created, it is immutable validate: isIntegrationType: SCM # Check to see what are the integration types and publish the list as well allowedIntegrationTypes: [GitHub, GitLab] # Allow only these types of integrations fileName: type: String immutable: true # Once the resource is created, it is immutable validate: notContains: 'bar' editors: type: String[] validate: isRegex: ["^[a-z]+$",'i'] # Each element in array is validated with this fileDtTm: type: Date scanInterval: type: Int validate: min: 1 max: 60 creds: type: Credential # User-defined data type


userDefinedDataType

Begins a set of data type definitions. User-defined data types specify property types with validation rules, and can be used as type values.

Tag Description of Usage Required/Optional
type String that identifies this user-defined type. Must conform to alpha validation (letters only). Required
configuration Begins a block of property definitions. Required

Each property definition begins with the name of the property (letters only, case-sensitive), followed by these subordinate tags:

Tag Description of Usage Required/Optional
type String that identifies an inbuilt or user-defineddata typeproperty. Required
required

When set as真正的, specifies that the property is mandatory.If no value is provided, pipeline sync will fail.

Default isfalse.

Optional
validate Begins avalidation specificationblock. Optional
userDefinedDataType Example
userDefinedDataType: - type: Credential # User-defined data type configuration: - userName: # first property type: String required: true validate: isRegex: ["^[a-z]+$",'i'] # RegExp from a string - password: # second property type: String validate: isRegex: ["^[a-z]+$",'i']

Shell Scripts

An extension resource definition may include optional shell scripts to be executed when the resource is used in a step as an input or output. These may be useful for:

  • Additional validation of properties
  • Testing for a property value to trigger a conditional action

onInput.sh

When present in the resource definition's repository directory, theonInput.shshell script will be executed whenever the resource is named among the step'sinputResources.


onInput.sh
test_input() { echo "onInput Executed" echo "resource name: $1" } execute_command "test_input %%context.resourceName%%"

onOutput.sh

When present in the resource definition's repository directory, theonOutput.shshell script will be executed whenever the resource is named among the step'sOutputResources.


onOutput.sh
test_output() { echo "onOutput Executed" echo "resource name: $1" } execute_command "test_output %%context.resourceName%%"
  • No labels
Copyright © 2022 JFrog Ltd.