可以使用以下代码片段将Bitbucket Pipeline生成的构建物保留14天,并删除超过14天未使用的构建物。
script:
- touch build_artifacts.tar.gz
- echo "Build step completed!"
artifacts:
- build_artifacts.tar.gz
after-script:
- echo "Build artifacts older than 14 days will be removed."
- find . -name "build_artifacts*.tar.gz" -mtime +14 -type f -delete
- echo "Build artifacts removal completed!"