blob: 4482141e1b89cb3d8b673cd47d45237e9099c0c3 [file] [log] [blame]
template: true # required for local templates.
valuesFilePath: ./values.yml
resources:
- name: infrastructure_test
type: GitRepo
configuration:
# SCM integration where the repository is located
gitProvider: {{ .Values.testRepo.gitProvider }} # this will be replaced from values.yml
# Repository path, including org name/repo name
path: {{ .Values.testRepo.path }} # this will be replaced from values.yml
branches:
# Specifies which branches will trigger dependent steps
include: master
- name: testPropertyBag
type: PropertyBag
configuration:
commitSha: 1
runID: 1
pipelines:
- name: test1_pipeline
steps:
- name: p1_s1
type: Bash
configuration:
inputResources:
# Sets up step to be triggered when there are commit events to myFirstRepo
- name: infrastructure_test
execution:
onExecute:
# Data from input resources is available as env variables in the step
- echo $res_infrastructure_test_commitSha
# The next two commands add variables to run state, which is available to all downstream steps in this run
# Run state documentation: https://www.jfrog.com/confluence/display/JFROG/Creating+Stateful+Pipelines#CreatingStatefulPipelines-RunState
- add_run_variables current_runid=$run_id
- add_run_variables commitSha=$res_infrastructure_test_commitSha
# This variable is written to pipeline state in p1_s3.
# So this will be empty during first run and will be set to prior run number in subsequent runs
# Pipeline state documentation: https://www.jfrog.com/confluence/display/JFROG/Creating+Stateful+Pipelines#CreatingStatefulPipelines-PipelineState
- echo "Previous run ID is $prev_runid"
- name: p1_s2
type: Bash
configuration:
inputSteps:
- name: p1_s1
execution:
onExecute:
# Demonstrates the availability of an env variable written to run state during p1_s1
- echo $current_runid
- name: p1_s3
type: Bash
configuration:
inputSteps:
- name: p1_s2
outputResources:
- name: testPropertyBag
execution:
onExecute:
- echo $current_runid
# Writes current run number to pipeline state
- add_pipeline_variables prev_runid=$run_id
# Uses an utility function to update the output resource with the commitSha that triggered this run
# Dependent pipelines can be configured to trigger when this resource is updated
# Utility functions documentation: https://www.jfrog.com/confluence/display/JFROG/Pipelines+Utility+Functions
- write_output testPropertyBag commitSha=$commitSha runID=$current_runid
- name: test2_pipeline
steps:
- name: p2_s1
type: Bash
configuration:
inputResources:
# Sets up step to be triggered when myPropertyBag is updated
- name: testPropertyBag
execution:
onExecute:
# Retrieves the commitSha from input resource
- echo "CommitSha is $res_testPropertyBag_commitSha"