diff options
Diffstat (limited to 'src/ci/shared.sh')
| -rw-r--r-- | src/ci/shared.sh | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/ci/shared.sh b/src/ci/shared.sh index 1f218bc8346..8a88c56194c 100644 --- a/src/ci/shared.sh +++ b/src/ci/shared.sh @@ -28,11 +28,7 @@ function retry { } function isCI { - [[ "${CI-false}" = "true" ]] || isAzurePipelines || isGitHubActions -} - -function isAzurePipelines { - [[ "${TF_BUILD-False}" = "True" ]] + [[ "${CI-false}" = "true" ]] || isGitHubActions } function isGitHubActions { @@ -63,9 +59,7 @@ function isCiBranch { fi name="$1" - if isAzurePipelines; then - [[ "${BUILD_SOURCEBRANCHNAME}" = "${name}" ]] - elif isGitHubActions; then + if isGitHubActions; then [[ "${GITHUB_REF}" = "refs/heads/${name}" ]] else echo "isCiBranch only works inside CI!" @@ -74,10 +68,7 @@ function isCiBranch { } function ciBaseBranch { - if isAzurePipelines; then - echo "unsupported on Azure Pipelines" - exit 1 - elif isGitHubActions; then + if isGitHubActions; then echo "${GITHUB_BASE_REF#refs/heads/}" else echo "ciBaseBranch only works inside CI!" @@ -86,9 +77,7 @@ function ciBaseBranch { } function ciCommit { - if isAzurePipelines; then - echo "${BUILD_SOURCEVERSION}" - elif isGitHubActions; then + if isGitHubActions; then echo "${GITHUB_SHA}" else echo "ciCommit only works inside CI!" @@ -97,9 +86,7 @@ function ciCommit { } function ciCheckoutPath { - if isAzurePipelines; then - echo "${BUILD_SOURCESDIRECTORY}" - elif isGitHubActions; then + if isGitHubActions; then echo "${GITHUB_WORKSPACE}" else echo "ciCheckoutPath only works inside CI!" @@ -114,9 +101,7 @@ function ciCommandAddPath { fi path="$1" - if isAzurePipelines; then - echo "##vso[task.prependpath]${path}" - elif isGitHubActions; then + if isGitHubActions; then echo "${path}" >> "${GITHUB_PATH}" else echo "ciCommandAddPath only works inside CI!" @@ -132,9 +117,7 @@ function ciCommandSetEnv { name="$1" value="$2" - if isAzurePipelines; then - echo "##vso[task.setvariable variable=${name}]${value}" - elif isGitHubActions; then + if isGitHubActions; then echo "${name}=${value}" >> "${GITHUB_ENV}" else echo "ciCommandSetEnv only works inside CI!" |
