HelloWorld
The HelloWorld template creates a simple pipeline that showcases a few of the basic features of JFrog Pipelines.
- Parallel steps
- Reading and writing variables that persist across different steps in your pipeline
- Reading from and writing to resources
- Setting environment variables
This template does not require any special configuration or pre-existing integration for you to try.
resources: - name: {{ .Values.namePrefix }}_bag type: PropertyBag configuration: releaseVersion: "" {{ if .Values.repo.integrationName }} - name: {{ .Values.namePrefix }}_repo type: GitRepo configuration: path: {{ .Values.repo.path }} gitProvider: {{ .Values.repo.integrationName }} branches: include: {{ .Values.repo.branchPattern }} {{ end }} pipelines: - name: {{ .Values.namePrefix }}_hello_world steps: - name: first type: Bash {{ if .Values.repo.integrationName }} configuration: inputResources: - name: {{ .Values.namePrefix }}_repo {{ end }} execution: onStart: - echo "onStart can be used to do some setup or initialization of your dependencies to prepare for the execution." onExecute: - echo "onExecute is the main section where you would issue your build/test commands" - jfrog --version {{ if .Values.repo.integrationName }} - echo "{{ .Values.namePrefix }}_repo sha is $(find_resource_variable {{ .Values.namePrefix }}_repo commitSha)" {{ end }} onSuccess: - echo "onSuccess executes if the onStart or onExecute sections completed without errors" onFailure: - echo "onFailure executes if either onStart or onExecute end in failure or error." onComplete: - echo "onComplete executes after onSuccess or onFailure" - name: variable_selection type: Bash configuration: inputSteps: - name: first environmentVariables: forceFail: default: "false" description: "set to 'true' to force the step to fail." values: - "false" - "true" execution: onStart: - if [ ${forceFail} == "true" ]; then exit 1; fi onExecute: - echo "This step will succeed" onFailure: - echo "step has failed." onSuccess: - echo "step has succeeded." onComplete: - echo "onComplete executes regardless of success or failure. forceFail is ${forceFail}" - name: add_run_variable type: Bash configuration: inputSteps: - name: first execution: onStart: - echo "This step will save a value to a run variable." onExecute: - add_run_variables step_info="runNumber $run_number, step_name $step_name, pipeline_name $pipeline_name" - name: write_to_resource type: Bash configuration: inputSteps: - name: add_run_variable - name: variable_selection outputResources: - name: {{ .Values.namePrefix }}_bag execution: onStart: - echo "Printing the run variable 'step_info' from previous step" - echo "${step_info}" onExecute: - echo "Updating resource {{ .Values.namePrefix }}_bag with new key/value pairs" - write_output {{ .Values.namePrefix }}_bag "timestamp=$(date +%s)" - write_output {{ .Values.namePrefix }}_bag "releaseVersion=${pipeline_name}.${run_number}" - write_output {{ .Values.namePrefix }}_bag "stepInfo=${step_info}" - name: read_from_resource type: Bash configuration: inputResources: - name: {{ .Values.namePrefix }}_bag execution: onExecute: - echo "printing resource details" - echo "Release Version is -- ${res_{{ .Values.namePrefix }}_bag_releaseVersion}" - echo "Release timestamp is -- ${res_{{ .Values.namePrefix }}_bag_timestamp}" - echo "Step Info is -- ${res_{{ .Values.namePrefix }}_bag_stepInfo}"
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
# This string will prefix the "HelloWorld" resource and pipeline. # it will allow you to add the pipeline multiple times with unique names namePrefix: intro ## # The following section is optional. If you have a repository you'd like to # experiment with, you can add it here. ## repo: # Before creating your Pipeline Source, create an integration for one of the # source control providers and put the integration name here. integrationName: myGitIntegration # this is the full repository path. Usually org/repo or user/project # depending on which source control you use. path: "myorgname/myreponame" # branchPattern is a regex, so you could listen to all # features, for example, with "^feature.*", or you can # just configure it for an individual branch branchPattern: "^main$"
GoCI
The GoCI template creates a pipeline that showcases the features of the GoBuild, GoPublishBinary, and GoPublishModule native steps. These features include:
- Building a Go binary and pushing the resulting artifact to Artifactory
- Building a Go module and pushing the resulting artifact to Artifactory
- Publishing Artifactory builds and updating output BuildInfo resources
- Utilizing JFrog Xray to scan the artifacts for security vulnerabilities
- Writing to output FileSpec resources that can be connected other pipelines.
This template can be used for binaries, modules, or both and the required configurations vary depending on the ultimate goal. Configuration must include the required settings for either GoBuild and GoPublishBinary or GoPublishModule and may include both to publish a binary and module.
In all cases these configurations must be set up:
- An Artifactory integration for resolving dependencies and publishing artifacts
- A Git integration (like GitHub) that can connect with your Gradle project
- A resolver Artifactory repository from which to resolve dependencies
Publishing a binary with GoBuild and GoPublishBinary requires:
- A binaryTargetRepository Artifactory repository to which to publish
- A command to run as part of the GoBuild step (the part following "go")
- An output file name
Publishing a binary with GoPublishModule requires:
- A moduleTargetRepository Artifactory repository to which to publish
- A version
resources: - name: {{ .Values.namePrefix }}_repo type: GitRepo configuration: path: {{ .Values.repo.path }} gitProvider: {{ .Values.repo.gitIntegration }} branches: include: {{ .Values.repo.branchPattern | default "main" }} {{ if .Values.publishBuild }} {{ if .Values.goConfig.binaryTargetRepository }} - name: {{ .Values.namePrefix }}_binary_info type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} - name: {{ .Values.namePrefix }}_binary_spec type: FileSpec configuration: sourceArtifactory: {{ .Values.artIntegration }} pattern: '{{ .Values.binaryBuildSpecPattern | default "*" }}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{ end }} {{ if .Values.goConfig.moduleTargetRepository }} - name: {{ .Values.namePrefix }}_module_info type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} - name: {{ .Values.namePrefix }}_module_spec type: FileSpec configuration: sourceArtifactory: {{ .Values.artIntegration }} pattern: '{{ .Values.moduleBuildSpecPattern | default "*" }}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{ end }} {{ end }} pipelines: - name: {{ .Values.namePrefix }}_go_ci steps: {{ if .Values.goConfig.binaryTargetRepository }} - name: build type: GoBuild configuration: affinityGroup: {{ .Values.namePrefix }}_go_binary_ci environmentVariables: JFROG_CLI_BUILD_NAME: {{ .Values.namePrefix }}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id} integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.goConfig.command }} goCommand: {{ .Values.goConfig.command }} {{ end }} {{ if .Values.goConfig.sourceLocation }} sourceLocation: {{ .Values.goConfig.sourceLocation }} {{ end }} {{ if .Values.goConfig.resolverRepo }} resolverRepo: {{ .Values.goConfig.resolverRepo }} {{ end }} {{ if .Values.goConfig.outputLocation }} outputLocation: {{ .Values.goConfig.outputLocation }} {{ end }} {{ if .Values.goConfig.outputFile }} outputFile: {{ .Values.goConfig.outputFile }} {{ end }} - name: publish type: GoPublishBinary configuration: affinityGroup: {{ .Values.namePrefix }}_go_binary_ci environmentVariables: JFROG_CLI_BUILD_NAME: {{ .Values.namePrefix }}_go_binary_ci JFROG_CLI_BUILD_NUMBER: ${run_id} integrations: - name: {{ .Values.artIntegration }} inputSteps: - name: build {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_binary_info - name: {{ .Values.namePrefix }}_binary_spec {{ end }} {{ if .Values.publishBuild }} autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} targetRepository: {{ .Values.goConfig.binaryTargetRepository }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_binary_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_binary_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }} {{ end }} {{ if .Values.goConfig.moduleTargetRepository }} - name: module type: GoPublishModule configuration: environmentVariables: JFROG_CLI_BUILD_NAME: {{ .Values.namePrefix }}_go_module_ci JFROG_CLI_BUILD_NUMBER: ${run_id} integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_module_info - name: {{ .Values.namePrefix }}_module_spec {{ end }} {{ if .Values.goConfig.sourceLocation }} sourceLocation: {{ .Values.goConfig.sourceLocation }} {{ end }} {{ if .Values.goConfig.version }} version: {{ .Values.goConfig.version }} {{ end }} targetRepository: {{ .Values.goConfig.moduleTargetRepository }} {{ if .Values.goConfig.resolverRepo }} resolverRepo: {{ .Values.goConfig.resolverRepo }} {{ end }} {{ if .Values.publishBuild }} autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_module_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_module_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }} {{ end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
## This string will prefix the resources and pipeline, allowing you to add ## the pipeline source multiple times with unique names. namePrefix: sample ## The name of your Artifactory integration artIntegration: myArtIntegrationName ##### Artifactory Build Info ## set this to `true` to publish builds #publishBuild: true ## set this to `true` to scan the published build(s) #scanBuild: true ## When publishBuild is enabled, a FileSpec resource will be created ## that points to each published build. Here you can specify a pattern ## to further narrow down the Artifacts that are referenced by the specs. ## The binaryBuildSpecPattern filters the files included for the FileSpec ## output by the GoPublishBinary step. #binaryBuildSpecPattern: "*" ## The moduleBuildSpecPattern filters the files included for the FileSpec ## output by the GoPublishModule step. #moduleBuildSpecPattern: "*" ##### Repository Details repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" goConfig: ### Settings used for both modules and binaries: ## The location of the source code in your repository. ## Commands will be executed here. sourceLocation: "." ## This repository, if specified, must first be created in Artifactory. ## The resolver is used to resolve dependencies. It is recommended to ## use a remote repository so that any external dependencies will be cached ## in your local Artifactory instance. resolverRepo: go-remote ### Settings used only for GoBuild and GoPublishBinary: ## Required to use these steps, the repository to which to upload the binary. ## The repository must first be created in Artifactory. binaryTargetRepository: go-local ## Here you specify any additional arguments to the command to execute ## it is executed as `go {{ command }}` command: "build -o $outputLocation/$outputFile" outputLocation: "GoBuild" outputFile: "myOutputFile" ### Settings used only for GoPublishModule: ## Required to use this step, the repository to which to upload the module. ## The repository must first be created in Artifactory. moduleTargetRepository: go-local ## The version specified in the go-publish command. version: v1.0.${run_number}
GradleCI
The GradleCI template creates a pipeline that showcases the features of the GradleBuild native step. These features include:
- Building a Gradle project and pushing the resulting artifacts to Artifactory
- Publishing an Artifactory build and updating an output BuildInfo resource
- Utilizing JFrog Xray to scan the artifacts for security vulnerabilities
- Writing to an output FileSpec resource that can be connected to another pipeline.
This template requires a few configurations to be set up:
- An Artifactory integration for resolving dependencies and publishing artifacts
- A Git integration (like GitHub) that can connect with your Gradle project
- Resolver and deployer Artifactory repositories
- A Gradle command to run as part of the GradleBuild step (the part following "gradle")
resources: - name: {{ .Values.namePrefix }}_repo type: GitRepo configuration: path: {{ .Values.repo.path }} gitProvider: {{ .Values.repo.gitIntegration }} branches: include: {{ .Values.repo.branchPattern | default "main" }} {{ if .Values.publishBuild }} - name: {{ .Values.namePrefix }}_info type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} - name: {{ .Values.namePrefix }}_spec type: FileSpec configuration: sourceArtifactory: {{ .Values.artIntegration }} pattern: '{{ .Values.buildSpecPattern | default "*" }}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{ end }} pipelines: - name: {{ .Values.namePrefix }}_gradle_ci {{ if .Values.publishBuild }} configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{ end }} steps: - name: build type: GradleBuild configuration: integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_info - name: {{ .Values.namePrefix }}_spec {{ end }} {{ if .Values.publishBuild }} autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} {{ if .Values.gradleConfig.command }} gradleCommand: {{ .Values.gradleConfig.command }} {{ end }} {{ if .Values.gradleConfig.sourceLocation }} sourceLocation: {{ .Values.gradleConfig.sourceLocation }} {{ end }} {{ if .Values.useWrapper }} useWrapper: true {{ end }} {{ if .Values.gradleConfig.resolverRepo }} resolverRepo: {{ .Values.gradleConfig.resolverRepo }} {{ end }} {{ if .Values.gradleConfig.deployerRepo }} deployerRepo: {{ .Values.gradleConfig.deployerRepo }} {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
## This string will prefix the resources and pipeline, allowing you to add ## the pipeline source multiple times with unique names. namePrefix: sample ## The name of your Artifactory integration artIntegration: myArtIntegrationName ##### Artifactory Build Info ## set this to `true` to publish a build #publishBuild: true ## set this to `true` to scan the published build #scanBuild: true ## When publishBuild is enabled, a FileSpec resource will be created ## that points to the published build. Here you can specify a pattern ## to further narrow down the Artifacts that are referenced by the spec. #buildSpecPattern: "*" ##### Repository Details repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Gradle configuration gradleConfig: ## Here you specify the command to execute ## it is executed as `gradle {{ command }}` command: "hello" sourceLocation: "." ## These repositories must first be created in Artifactory. ## The resolver is used to resolve dependencies. It is recommended to ## use a remote repository so that any external dependencies will be cached ## in your local Artifactory instance. Deployer is where your Artifacts ## will be uploaded. resolverRepo: gradle-remote deployerRepo: gradle-local ## If your project uses the Gradle Wrapper set useWrapper to true #useWrapper: true
MavenCI
The MavenCI template creates a pipeline that showcases the features of the MvnBuild native step. These features include:
- Building a Maven project and pushing the resulting artifacts to Artifactory
- Publishing an Artifactory build and updating an output BuildInfo resource
- Utilizing JFrog Xray to scan the artifacts for security vulnerabilities
- Writing to an output FileSpec resource that can be connected to another pipeline
This template requires a few configurations to be set up:
- An Artifactory integration for resolving dependencies and publishing artifacts
- A Git integration (like GitHub) that can connect with your Maven project
- Resolver and deployer Artifactory Maven repositories for snapshots and releases
resources: - name: {{ .Values.namePrefix }}_repo type: GitRepo configuration: path: {{ .Values.repo.path }} gitProvider: {{ .Values.repo.gitIntegration }} branches: include: {{ .Values.repo.branchPattern | default "main" }} {{ if .Values.publishBuild }} - name: {{ .Values.namePrefix }}_info type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} - name: {{ .Values.namePrefix }}_spec type: FileSpec configuration: sourceArtifactory: {{ .Values.artIntegration }} pattern: '{{ .Values.buildSpecPattern | default "*" }}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{ end }} pipelines: - name: {{ .Values.namePrefix }}_maven_ci {{ if .Values.publishBuild }} configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{ end }} steps: - name: build type: MvnBuild configuration: integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_info - name: {{ .Values.namePrefix }}_spec autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} {{ if .Values.mavenConfig.command }} mvnCommand: {{ .Values.mavenConfig.command }} {{ end }} {{ if .Values.mavenConfig.sourceLocation }} sourceLocation: {{ .Values.mavenConfig.sourceLocation }} {{ end }} {{ if .Values.mavenConfig.resolverSnapshotRepo }} resolverSnapshotRepo: {{ .Values.mavenConfig.resolverSnapshotRepo }} {{ end }} {{ if .Values.mavenConfig.deployerSnapshotRepo }} deployerSnapshotRepo: {{ .Values.mavenConfig.deployerSnapshotRepo }} {{ end }} {{ if .Values.mavenConfig.resolverReleaseRepo }} resolverReleaseRepo: {{ .Values.mavenConfig.resolverReleaseRepo }} {{ end }} {{ if .Values.mavenConfig.deployerReleaseRepo }} deployerReleaseRepo: {{ .Values.mavenConfig.deployerReleaseRepo }} {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
## This string will prefix the resources and pipeline. ## It will allow you to add a pipeline source from this ## template multiple times with unique names. namePrefix: sample ## The name of your Artifactory integration artIntegration: myArtIntegrationName ##### Artifactory Build Info ## set this to `true` to publish a build #publishBuild: true ## set this to `true` to scan the published build #scanBuild: true ## When publishBuild is enabled, a FileSpec resource will be created ## that points to the published build. Here you can specify a pattern ## to further narrow down the Artifacts that are referenced by the spec. #buildSpecPattern: "*" ##### Repository Details repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" ##### Maven configuration mavenConfig: ## Here you specify the command to execute ## it is executed as `mvn {{ command }}` command: clean install sourceLocation: "MavenCI/sample-project" ## These repos must first be created in Artifactory. ## resolver is used to resolve dependencies. It is recommended to ## use a remote repository so that any external dependencies will be cached ## in your local Artifactory instance. Deployer is where your Artifacts ## will be uploaded. resolverSnapshotRepo: maven-snapshot-remote resolverReleaseRepo: maven-release-remote deployerSnapshotRepo: maven-snapshot-local deployerReleaseRepo: maven-release-local
NpmCI
The NpmCI template creates a pipeline that showcases the features of the NpmBuild and NpmPublish native steps. These features include:
- Building an npm project and pushing the resulting artifacts to Artifactory
- Publishing an Artifactory build and updating an output BuildInfo resource
- Utilizing JFrog Xray to scan the artifacts for security vulnerabilities
- Writing to an output FileSpec resource that can be connected to another pipeline.
This template requires a few configurations to be set up:
- An Artifactory integration for resolving dependencies and publishing artifacts
- A Git integration (like GitHub) that can connect with your npm project
- Resolver and deployer Artifactory repositories
resources: - name: {{ .Values.namePrefix }}_repo type: GitRepo configuration: path: {{ .Values.repo.path }} gitProvider: {{ .Values.repo.gitIntegration }} branches: include: {{ .Values.repo.branchPattern | default "main" }} {{ if .Values.publishBuild }} - name: {{ .Values.namePrefix }}_info type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} - name: {{ .Values.namePrefix }}_spec type: FileSpec configuration: sourceArtifactory: {{ .Values.artIntegration }} pattern: '{{ .Values.buildSpecPattern | default "*" }}' buildName: ${JFROG_CLI_BUILD_NAME} buildNumber: ${JFROG_CLI_BUILD_NUMBER} {{ end }} pipelines: - name: {{ .Values.namePrefix }}_npm_ci configuration: affinityGroup: {{ .Values.namePrefix }}_npm_ci {{ if .Values.publishBuild }} environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} {{ end }} steps: - name: build type: NpmBuild configuration: integrations: - name: {{ .Values.artIntegration }} inputResources: - name: {{ .Values.namePrefix }}_repo {{ if .Values.npmConfig.npmArgs }} npmArgs: {{ .Values.npmConfig.npmArgs }} {{ end }} {{ if .Values.npmConfig.sourceLocation }} sourceLocation: {{ .Values.npmConfig.sourceLocation }} {{ end }} {{ if .Values.npmConfig.resolverRepo }} resolverRepo: {{ .Values.npmConfig.resolverRepo }} {{ end }} - name: publish type: NpmPublish configuration: integrations: - name: {{ .Values.artIntegration }} inputSteps: - name: build {{ if .Values.publishBuild }} outputResources: - name: {{ .Values.namePrefix }}_info - name: {{ .Values.namePrefix }}_spec {{ end }} {{ if .Values.publishBuild }} autoPublishBuildInfo: true {{ end }} {{ if and .Values.scanBuild .Values.publishBuild }} forceXrayScan: true {{ end }} {{ if .Values.npmConfig.deployerRepo }} deployerRepo: {{ .Values.npmConfig.deployerRepo }} {{ end }} {{ if .Values.publishBuild }} execution: onSuccess: - write_output {{ .Values.namePrefix }}_spec buildName="${JFROG_CLI_BUILD_NAME}" - write_output {{ .Values.namePrefix }}_spec buildNumber="${JFROG_CLI_BUILD_NUMBER}" {{ end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
## This string will prefix the resources and pipeline, allowing you to add ## the pipeline source multiple times with unique names. namePrefix: sample ## The name of your Artifactory integration artIntegration: myArtIntegrationName ##### Artifactory Build Info ## set this to `true` to publish a build #publishBuild: true ## set this to `true` to scan the published build #scanBuild: true ## When publishBuild is enabled, a FileSpec resource will be created ## that points to the published build. Here you can specify a pattern ## to further narrow down the Artifacts that are referenced by the spec. #buildSpecPattern: "*" ##### Repository Details repo: path: org/repo gitIntegration: myGitIntegration branchPattern: "^main$" npmConfig: ## Here you specify any additional arguments to the command to execute ## it is executed as `npm install {{ npmArgs }}` npmArgs: "--no-install" sourceLocation: "." ## These repositories must first be created in Artifactory. ## The resolver is used to resolve dependencies. It is recommended to ## use a remote repository so that any external dependencies will be cached ## in your local Artifactory instance. Deployer is where your Artifacts ## will be uploaded. resolverRepo: npm-remote deployerRepo: npm-local
PromoteCI
The PromoteCI template creates a pipeline that showcases the features of the PromoteBuild native step. These features include:
- Promoting an Artifactory build created by another pipeline
- Updating an output BuildInfo resource with the promoted build info
- Optionally, using Signed Pipelines that can be connected to another pipeline
This template requires a few configurations to be set up:
- An input BuildInfo resource with build to promote, typically an output from another pipeline
- An Artifactory integration for the output BuildInfo resource that will be used to promote the build
- A target Artifactory repository
resources: - name: {{ .Values.namePrefix }}_promotedBuildInfo type: BuildInfo configuration: sourceArtifactory: {{ .Values.artIntegration }} pipelines: - name: {{ .Values.namePrefix }}_promote_ci configuration: environmentVariables: readOnly: JFROG_CLI_BUILD_NAME: ${pipeline_name} JFROG_CLI_BUILD_NUMBER: ${run_id} steps: - name: promote type: PromoteBuild configuration: inputResources: - name: {{ .Values.inputBuildInfoResourceName }} {{ if .Values.inputBuildInfoResourceBranch }} branch: {{ .Values.inputBuildInfoResourceBranch }} {{ end }} outputResources: - name: {{ .Values.namePrefix }}_promotedBuildInfo targetRepository: {{ .Values.targetRepository }} {{ if .Values.includeDependencies }} includeDependencies: {{ .Values.includeDependencies }} {{ end }} {{ if .Values.status }} status: {{ .Values.status }} {{ end }} {{ if .Values.comment }} comment: {{ .Values.comment }} {{ end }} {{ if .Values.copy }} copy: {{ .Values.copy }} {{ end }} {{ if .Values.failOnValidate }} failOnValidate: {{ .Values.failOnValidate }} {{ end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
## This string will prefix the resources and pipeline, allowing you to add ## the pipeline source multiple times with unique names. namePrefix: sample ## The name of your Artifactory integration artIntegration: myArtIntegrationName ## The name of the BuildInfo resource referencing the build to be promoted inputBuildInfoResourceName: myBuildInfo ## If your input BuildInfo resource is from a multi-branch pipeline source and ## you wish to use the resource from another branch, specify that branch name. #inputBuildInfoResourceBranch: myBranchToUseAsInput ##### Promotion Info ## the repository to which to promote the build targetRepository: myPromotionRepo ## set this to `true` to include dependencies in the promotion #includeDependencies: true ## set this to `true` to copy and not move the promoted files #copy: true ## set this to `true` to validate the input BuildInfo through Signed Pipelines #failOnValidate: true ## the promotion status for the build #status: TEST ## the promotion comment for the build #comment: "Promoted by run number ${run_number}."
DockerBuildAndPush
The DockerBuildAndPush template creates a pipeline that builds a Docker image from an SCM repository and pushes it to a Docker registry. Version 1.0.0 of this template uses JFrog CLI v1 and version 1.1.0 uses JFrog CLI v2. Template version 1.0.0 requires targetRepository
and sourceRepository
settings (see template readme) and template version 1.1.0 does not use these settings.
resources: - name: {{ .Values.GitRepo.name | default "GitRepoRes" }} type: GitRepo configuration: gitProvider: {{ .Values.GitRepo.gitProvider }} path: {{ .Values.GitRepo.path }} {{- if or (.Values.GitRepo.branches.include) (.Values.GitRepo.branches.exclude) }} branches: {{- if .Values.GitRepo.branches.include }} include: {{ .Values.GitRepo.branches.include }} {{- end }} {{- if .Values.GitRepo.branches.exclude }} exclude: {{ .Values.GitRepo.branches.exclude }} {{- end }} {{- end }} - name: {{ .Values.Image.name | default "ImageRes" }} type: Image configuration: registry: {{ .Values.artifactoryIntegration }} imageName: {{ .Values.DockerBuild.dockerImageName }} imageTag: {{ .Values.DockerBuild.dockerImageTag | default "latest" }} autoPull: {{ .Values.Image.autopull | default true }} {{- if .Values.BuildInfo }} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} type: BuildInfo configuration: sourceArtifactory: {{ .Values.artifactoryIntegration }} buildName: {{ .Values.DockerPush.name | default "DockerPush" }} buildNumber: {{ .Values.BuildInfo.buildNumber | default 1 }} {{- end }} pipelines: - name: {{ .Values.Pipeline.name | default "Pipeline" }} configuration: jfrogCliVersion: 2 steps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} type: DockerBuild configuration: affinityGroup: DockerBuildAndPush dockerFileLocation: {{ .Values.DockerBuild.dockerFileLocation | default "." | quote }} dockerFileName: {{ .Values.DockerBuild.dockerFileName | default "Dockerfile" }} dockerImageName: {{ .Values.DockerBuild.dockerImageName }} dockerImageTag: {{ .Values.DockerBuild.dockerImageTag }} inputResources: - name: {{ .Values.GitRepo.name | default "GitRepoRes" }} integrations: - name: {{ .Values.artifactoryIntegration }} - name: {{ .Values.DockerPush.name | default "DockerPush" }} type: DockerPush configuration: {{- if .Values.BuildInfo }} autoPublishBuildInfo: {{ .Values.BuildInfo.autoPublishBuildInfo | default true }} {{- end }} affinityGroup: DockerBuildAndPush integrations: - name: {{ .Values.artifactoryIntegration }} inputSteps: - name: {{ .Values.DockerBuild.name | default "DockerBuild" }} outputResources: - name: {{ .Values.Image.name | default "ImageRes" }} {{- if .Values.BuildInfo }} - name: {{ .Values.BuildInfo.name | default "BuildInfo" }} {{- end }}
values.yml: This is a sample values.yml
. This can be edited to create your own version of the file.
GitRepo: # Required. name: fooGitRepo # Name of the GitRepo resource. Defaults to GitRepoRes. gitProvider: github # Required. Name of the SCM integration which will be used to fetch the SCM. repository. path: jfrog/jfrog-pipelines-simple-example # Required. Path to the SCM repository. branches: exclude: 'master' # Regex pattern to exclude branches. include: ^{{gitBranch}}$ # Regex pattern to include branches. artifactoryIntegration: art # Required. Name of the artifactory integration using which the docker image will be pushed. Image: # Required. name: fooImage # Name of the Image resource. Defaults to ImageRes. autoPull: false # Defaults to true. DockerBuild: # Required. name: foobuild # Name of the DockerBuild step. Defaults to DockerBuild. dockerImageName: foo # Required. Name of the docker image getting built. dockerFileName: foo # Required. Name of the Dockerfile. dockerFileLocation: '.' # Required. Path to Dockerfile. dockerImageTag: ${run_number} # Name of the docker image tag. Defaults to latest. Pipeline: name: foo # Name of the pipeline. Defaults to Pipeline. DockerPush: # Required. name: foopush # Name of the DockerPush step. Defaults to DockerPush. BuildInfo: # Optional, if the BuildInfo needs to be published. autoPublishBuildInfo: true # Defaults to true. name: fooBuildInfo # Name of the BuildInfo resource. Defaults to BuildInfo.
HelmPublishAndDeploy
The HelmPublishAndDeploy template creates a pipeline that publishes a Helm Chart to a Helm repository in Artifactory, creates a Build Info, promotes the Build, and then deploys the Helm Chart from the promoted Build resource using the HelmDeploy native step. Version 1.0.0 of this template uses JFrog CLI v1 and version 1.1.0 uses JFrog CLI v2.
values.yml: This is a sample values.yml
, which can be edited to create your own version of the file.
artifactoryIntegration: artifactory_integration # Required. Name of the Artifactory integration. kubernetesIntegration: kubernetes_integration # Required. Name of the Kubernetes integration. GitRepo: # Required. name: fooGitRepo # Name of the GitRepo resource. Defaults to GitRepoRes. gitProvider: github # Required. Name of the SCM integration which will be used to fetch the SCM repository. path: jfrog/jfrog-pipelines-simple-example # Required. Path to the SCM repository. branches: # Optional. exclude: ^master$ # Regex pattern to exclude branches. include: ^{{gitBranch}}$ # Regex pattern to include branches. files: # Optional. exclude: ^fileName$ # Regex pattern to exclude files. include: ^fileName$ # Regex pattern to include files. BuildInfo: # Required. name: fooBuild # Name of the BuildInfo resource. Defaults to BuildInfoRes. buildName: foo # Optional. Name of the Artifactory Build that will be created. Defaults to $pipeline_name. buildNumber: $run_number # Optional. Number of the Artifactory Build that will be created. Defaults to $run_number. BuildInfoPromoted: # Optional. name: fooBuildInfoPromoted # Name of the promoted BuildInfo resource. Defaults to BuildInfoPromotedRes. autoPromotion: false # Optional. When set to false, indicates that Build promotion in the pipeline will be manually triggered. Defaults to true. HelmChart: # Required. name: fooHelmChart # Name of the HelmChart resource. Defaults to HelmChartRes. chartName: foo # Required. Helm chart name. chartVersion: 0.0.1 # Required. Helm chart version. repository: foo # Required. The name of the Helm repository in Artifactory. helmVersion: 3 # Optional. A number representing the major version of Helm to use. Defaults to 3. namespace: foo # Optional. Set the namespace used for the Helm operations. Only supported when used with Helm 3. Pipeline: # Optional. name: foo # Name of the pipeline. Defaults to HelmDeployPipeline. HelmPublish: # Required. name: HelmPublish # Name of the HelmPublish step. Defaults to HelmPublish. chartPath: '.' # Required. The path to the Helm chart YAML in the GitRepo resource. flags: '--app-version=foo' # Optional. Command line options to pass to the helm package command. lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false. lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command. valueFilePaths: # Optional. Specifies values YAML file(s) that will be used in the lint command helm lint command. - values.yaml # Optional. An exmaple of how to add a values YAML file. - values2.yaml # Optional. An exmaple of how to add an additional values YAML file. PromoteBuild: # Optional. name: fooPromoteBuild # Name of the PromoteBuild step. Defaults to PromoteBuild. targetRepository: fooPromote # Required. The name of the repository in Artifactory to promote the build to. copy: false # Optional. When set to true, copies the artifacts to the targetRepository vs moving them to the targetRepository. Defaults to false. HelmDeploy: # Required. name: fooHelmDeploy # Name of the HelmDeploy step. Defaults to HelmDeploy. chartPath: '.' # Required. The path to the Helm chart YAML in the input BuildInfo resource. releaseName: foo # Required. The release name. Equivalent to the --name (-n) option of the helm install command. flags: '--wait --timeout 900s' # Optional. Command line options to pass to the helm upgrade command. lint: true # Optional. When set to true performs a lint to examine a Helm chart for possible issues. Defaults to false. lintFlags: '--strict' # Optional. Flag string to pass to the helm lint command. valueFilePaths: # Optional. Specifies values YAML file(s) for use with a --values (-f) option of the helm lint command. - values.yaml - values2.yaml test: true # Optional. When set to true performs a test to run the tests for release. Defaults to false. testFlags: # Optional. Flag string to pass to the helm test command.
Using Global Templates to Create a Pipeline Source (1.31.0 and higher)
To use a global template as a pipeline source:
In your SCM repository, create a new directory named
.jfrog-pipelines
.In the directory, create two new files:
pipelines.yml
values.yml
pipelines.yml: Add the following in the
pipelines.yml
file:valuesFilePath: ./values.yml include: template: jfrog/<global_template_name>/<template_version>
ExamplevaluesFilePath: ./values.yml include: template: jfrog/HelloWorld/1.0.0
Where:jfrog
is the predefined namespace to be used for global templates. This is mandatory and cannot be changed.global_template_name
is the name of the global template you want to use. Go to Pipelines | Extensions & Templates and click the Templates tab to find all the available preloaded templates.template_version
is the version of the template you want to use. Go to Pipelines | Extensions & Templates and click the Templates tab to find the versions available for each template.valuesFilePath
is the path where thevalues.yml
file is stored.
- values.yml: Update the
values.yml
file to include the values required for the global template you are using. For more information, see the examplevalues.yml
file. - In the JFrog Platform, go to Administration → Pipelines → Pipeline Sources and add the pipeline as a pipeline source. For more information, see Adding a Pipeline Source.
After your Pipeline Source syncs successfully, you can view the newly added pipeline by navigating to My Pipelines on the left navbar and clicking Pipelines → My Pipelines. - Go to Application → Pipelines → My Pipelines → All Pipelines and run the pipeline.
Using Global Templates to Create a Pipeline Source (1.30.0 and lower)
Perform the following steps to use a Global Template to create a pipeline source:
Go to Administration | Pipelines | Pipeline Sources, and click Add Pipeline Source, and From Template.
- Complete the resulting Select Template form:
- Click the Select Template Namespace field and select the
jfrog
namespace. - Click the Select Template Name field and select the
DockerBuildAndPush
orHelmPublishAndDeploy
global template. Click the Select Template Version field and select the relevant version for the template.
- Click the Select Template Namespace field and select the
Click Next and complete the resulting Specify values file form to add the
values.yml
file.Click the Integration field and select your source control integration from the dropdown list.
- In the Repository Full Name field, enter the path of the repository where your
values.yml
is stored. - Specify the Branch of the repository (for example,
master
). In the Values File Path field, provide the path to the
values.yml
file, which contains the values for the global template. By default, this field is set to take the file from the root directory. If yourvalues.yml
file is stored in a different directory, enter the full path.When you do this, the
values.yml
file is parsed and values are added as configured in the file.For more information about the Specify values file form, see the section Adding a Pipeline Source.
- Click Create Source to add the Pipeline Source.
The combination of pipeline template name, namespace, version and values.yml
is parsed to create the pipeline definition.
After your Pipeline Source syncs successfully, you can view the newly added pipeline by navigating to My Pipelines on the left navbar and clicking Pipelines → My Pipelines.