我是YAML文件的新手。我想每次都将时间戳添加到S3存储桶文件夹,以便每个构建都是唯一的。在post_build中,我将时间戳附加到S3存储桶,如下所示。触发代码管道时,所有文件都存储到S3 bucket Inhouse文件夹中,但不会生成带有时间戳的文件夹。s3:// $ {S3_BUCKET} / Inhouse / $ {'date'}
Version: 0.2
env:
variables:
S3_BUCKET: Inhouse-market-dev
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
- npm install -g @angular/cli
build:
commands:
- echo Build started on `date`
post_build:
commands:
- aws s3 cp . s3://${S3_BUCKET}/Inhouse/${'date'} --recursive --acl public-read --cache-control "max-age=${CACHE_CONTROL}"
- echo Build completed on `date`
我认为您的使用${'date'}
是不正确的。我建议尝试以下操作以实际获取Unix时间戳:
post_build:
commands:
- current_timestamp=$(date +"%s")
- aws s3 cp . s3://${S3_BUCKET}/Inhouse/${current_timestamp} --recursive --acl public-read --cache-control "max-age=${CACHE_CONTROL}"
- echo Build completed on `date` which is ${current_timestamp}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句