I have a S3 resource definition where the object path(regexp) need to have a date variable in it.
resources:
- name: add_file_to_s3
type: s3
source:
access_key_id: ((access_key_id))
bucket: pipeline-assets
regexp: size_monitor/((date))/size_(.*).csv
secret_access_key: ((secret_access_key))
I have tried creating a task generate-date
for generating the current date, loading it and passing it to add_file_to_s3
resource.
jobs:
- name: size-monitor
serial: true
plan:
- in_parallel:
- get: ci-image
- get: repo
trigger: true
passed:
- set-pipeline
- task: generate-date
image: ci-image
config:
platform: linux
outputs:
- name: current-date
run:
path: /bin/sh
args:
- -c
- |
DATE=$(date +%Y-%m-%d)
echo $DATE > current-date/date.env
- load_var: current_date
file: current-date/date.env
- task: size-monitor-script
image: ci-image
file: repo/ci/size_monitor/task.yml
params:
#params here
- put: add_file_to_s3
params:
file: output_dir/size_*.csv
date: current_date
The task size-monitor-script
will generate a csv file at the location output_dir/size_*.csv
.
This logic is not passing the date variable to the resource. Is there any other way it could be passed? Any help would be greatly appreciated. Thanks!