From e29b5bbf5defa4cc1afaad45545617a9a0b868b0 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Mon, 14 Aug 2023 05:24:37 -0700 Subject: [PATCH] Store artifacts only on main and stable branches (#38954) Summary: This change stores artifacts in CI only when it runs in main or in a stable branch ## Changelog: [Internal] - Store CI artifacts only on main or on stable branches Pull Request resolved: https://github.com/facebook/react-native/pull/38954 Test Plan: CircleCI stays green and we don't store anything on pr branch Reviewed By: cortinico Differential Revision: D48267659 Pulled By: cipolleschi fbshipit-source-id: 6257270948c770e09492691c995cbe84d7a085ac --- .circleci/config.yml | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7840c033a00..dad99aec3db 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -470,15 +470,15 @@ commands: condition: equal: [ << parameters.flavor >>, "Debug"] steps: - - store_artifacts: + - store_artifacts_if_needed: path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-debug.tar.gz - when: condition: equal: [ << parameters.flavor >>, "Release"] steps: - - store_artifacts: + - store_artifacts_if_needed: path: /tmp/hermes/hermes-runtime-darwin/hermes-ios-release.tar.gz - - store_artifacts: + - store_artifacts_if_needed: path: /tmp/hermes/osx-bin/<< parameters.flavor >>/hermesc stop_job_if_apple_artifacts_are_there: @@ -605,6 +605,31 @@ commands: paths: - << parameters.pods_build_folder >> + store_artifacts_if_needed: + description: "This step stores the artifacts only if we are on main or on a stable branch" + parameters: + path: + type: string + destination: + type: string + default: << parameters.path >> + when: + type: enum + enum: ['always', 'on_fail', 'on_success'] + default: 'always' + steps: + - when: + condition: + or: + - equal: [ main, << pipeline.git.branch >> ] + - matches: + pattern: /0\.[0-9]+[\.[0-9]+]?-stable/ + value: << pipeline.git.branch >> + steps: + - store_artifacts: + when: << parameters.when >> + path: << parameters.path >> + destination: << parameters.destination >> # ------------------------- @@ -813,7 +838,7 @@ jobs: cd /Users/distiller/Library/Developer/Xcode XCRESULT_PATH=$(find . -name '*.xcresult') tar -zcvf xcresults.tar.gz $XCRESULT_PATH - - store_artifacts: + - store_artifacts_if_needed: path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz # ------------------------- # Collect Results @@ -1519,7 +1544,7 @@ jobs: paths: - /tmp/hermes/linux64-bin/ - /tmp/hermes/hermes/destroot/ - - store_artifacts: + - store_artifacts_if_needed: path: /tmp/hermes/linux64-bin/ - persist_to_workspace: root: /tmp/hermes/ @@ -1794,7 +1819,7 @@ jobs: - C:\tmp\hermes\hermes\icu\ - C:\tmp\hermes\hermes\deps\ - C:\tmp\hermes\hermes\build_release\ - - store_artifacts: + - store_artifacts_if_needed: path: C:\tmp\hermes\win64-bin\ - persist_to_workspace: root: C:\tmp\hermes\ @@ -1910,7 +1935,6 @@ jobs: - store_artifacts: path: /tmp/maven-local.zip - store_artifacts: - when: on_fail path: /root/.npm/_logs - persist_to_workspace: root: /tmp