You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.4 KiB
78 lines
1.4 KiB
#@ def unit_tests():
|
|
name: unit-tests
|
|
plan:
|
|
- get: repo
|
|
trigger: true
|
|
- task: run-unit-tests
|
|
config:
|
|
platform: linux
|
|
image_resource:
|
|
type: mock
|
|
source:
|
|
mirror_self: true
|
|
inputs:
|
|
- name: repo
|
|
run:
|
|
path: sh
|
|
args:
|
|
- -c
|
|
- |
|
|
echo running the unit tests...
|
|
cat repo/branch.txt
|
|
sleep 4
|
|
echo tests passed!
|
|
#@ end
|
|
|
|
#@ def build_rc_image():
|
|
name: build-image
|
|
plan:
|
|
- get: repo
|
|
trigger: true
|
|
passed: [unit-tests]
|
|
- task: build-image
|
|
config:
|
|
platform: linux
|
|
image_resource:
|
|
type: mock
|
|
source:
|
|
mirror_self: true
|
|
inputs:
|
|
- name: repo
|
|
outputs:
|
|
- name: image
|
|
run:
|
|
path: sh
|
|
args:
|
|
- -c
|
|
- |
|
|
echo building the image...
|
|
date +%Y-%m-%d > image/version
|
|
sleep 2
|
|
echo image built!
|
|
- put: image-rc
|
|
params:
|
|
file: image/version
|
|
#@ end
|
|
|
|
#@ def deploy(deployment_env):
|
|
name: #@ "deploy-" + deployment_env
|
|
plan:
|
|
- in_parallel:
|
|
- get: repo
|
|
passed:
|
|
#@ if deployment_env == "dev":
|
|
- build-image
|
|
#@ elif deployment_env == "prod":
|
|
- deploy-dev
|
|
#@ end
|
|
- get: image-rc
|
|
passed:
|
|
#@ if deployment_env == "dev":
|
|
- build-image
|
|
#@ elif deployment_env == "prod":
|
|
- deploy-dev
|
|
#@ end
|
|
- put: #@ deployment_env + "-env"
|
|
params:
|
|
file: image-rc/oci_image
|
|
#@ end
|