-
Notifications
You must be signed in to change notification settings - Fork 7
/
bitrise.inc.sh
113 lines (104 loc) · 3.14 KB
/
bitrise.inc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/usr/bin/env bash
# shellcheck disable=SC2034
set -euo pipefail
function yp_ci_env_bitrise() {
[[ "${BITRISE_IO:-}" = "true" ]] || return 0
export CI=true
YP_CI_NAME=Bitrise
YP_CI_PLATFORM=bitrise
YP_CI_SERVER_HOST=app.bitrise.io
YP_CI_REPO_SLUG=${BITRISEIO_GIT_REPOSITORY_SLUG:-}
YP_CI_ROOT=${BITRISE_SOURCE_DIR:-}
YP_CI_IS_CRON=
YP_CI_IS_PR=
[[ -z "${BITRISE_PULL_REQUEST:-}" ]] || YP_CI_IS_PR=true
# 1 pipeline -> n jobs
YP_CI_JOB_ID=${BITRISE_BUILD_NUMBER:-}
YP_CI_PIPELINE_ID=${YP_CI_JOB_ID}
YP_CI_JOB_URL=${BITRISE_BUILD_URL:-}
YP_CI_PIPELINE_URL=${YP_CI_JOB_URL}
YP_CI_PR_NUMBER=
YP_CI_PR_URL=
YP_CI_PR_REPO_SLUG=
YP_CI_PR_GIT_HASH=
YP_CI_PR_GIT_BRANCH=
[[ "${YP_CI_IS_PR}" != "true" ]] || {
YP_CI_PR_NUMBER=${BITRISE_PULL_REQUEST:-}
YP_CI_PR_URL=https://github.com/${YP_CI_REPO_SLUG}/pull/${YP_CI_PR_NUMBER}
YP_CI_PR_REPO_SLUG=$(basename $(dirname "${BITRISEIO_PULL_REQUEST_REPOSITORY_URL:-}"))/$(basename "${BITRISEIO_PULL_REQUEST_REPOSITORY_URL:-}") # editorconfig-checker-disable-line
YP_CI_PR_GIT_HASH= # TODO
YP_CI_PR_GIT_BRANCH=${BITRISEIO_PULL_REQUEST_HEAD_BRANCH:-}
}
YP_CI_GIT_HASH=${BITRISE_GIT_COMMIT:-}
YP_CI_GIT_BRANCH=${BITRISE_GIT_BRANCH:-}
[[ "${YP_CI_IS_PR}" != "true" ]] || YP_CI_GIT_BRANCH=${BITRISEIO_PULL_REQUEST_MERGE_BRANCH:-}
YP_CI_GIT_TAG=${BITRISE_GIT_TAG:-}
YP_CI_DEBUG_MODE=${YP_CI_DEBUG_MODE:-}
}
function yp_ci_printvars_bitrise() {
printenv_all | sort -u | grep \
-e "^CI=" \
-e "^BITRISE[=_]" \
-e "^GIT_REPOSITORY_URL=" \
-e "^PR="
}
function yp_ci_known_env_bitrise() {
# see https://devcenter.bitrise.io/en/references/available-environment-variables.html#available-environment-variables # editorconfig-checker-disable-line
cat <<EOF
BITRISE_TRIGGERED_WORKFLOW_ID
BITRISE_TRIGGERED_WORKFLOW_TITLE
BITRISE_BUILD_STATUS
BITRISE_SOURCE_DIR
BITRISE_DEPLOY_DIR
CI
PR
BITRISE_BUILD_NUMBER
BITRISE_APP_TITLE
BITRISE_APP_URL
BITRISE_APP_SLUG
BITRISE_BUILD_URL
BITRISE_BUILD_SLUG
BITRISE_BUILD_TRIGGER_TIMESTAMP
GIT_REPOSITORY_URL
BITRISE_GIT_BRANCH
BITRISEIO_GIT_BRANCH_DEST
BITRISE_GIT_TAG
BITRISE_GIT_COMMIT
BITRISE_GIT_MESSAGE
BITRISEIO_GIT_REPOSITORY_OWNER
BITRISEIO_GIT_REPOSITORY_SLUG
BITRISE_PULL_REQUEST
BITRISEIO_PULL_REQUEST_REPOSITORY_URL
BITRISEIO_PULL_REQUEST_MERGE_BRANCH
BITRISEIO_PULL_REQUEST_HEAD_BRANCH
BITRISE_PROVISION_URL
BITRISE_CERTIFICATE_URL
BITRISE_CERTIFICATE_PASSPHRASE
BITRISE_IO
EOF
# undocumented but observed
cat <<EOF
BITRISE_BRIDGE_WORKDIR
BITRISE_BUILD_API_TOKEN
BITRISE_CACHE_API_URL
BITRISE_CACHE_DIR
BITRISE_DEFAULT_CERTIFICATE_PASSPHRASE
BITRISE_DEFAULT_CERTIFICATE_URL
BITRISE_DEFAULT_PROVISION_URL
BITRISE_DEPLOY_UPLOAD_CONCURRENCY
BITRISE_DOCKER_REV_NUMBER_ANDROID
BITRISE_DOCKER_REV_NUMBER_ANDROID_NDK
BITRISE_DOCKER_REV_NUMBER_BASE
BITRISE_PREP_DIR
BITRISE_SECRET_ENV_KEY_LIST
BITRISE_SECRET_ENVS_FILTERING
BITRISE_SECRET_FILTERING
BITRISE_STEP_EXECUTION_ID
BITRISE_STEP_FORMATTED_OUTPUT_FILE_PATH
BITRISE_STEP_SOURCE_DIR
BITRISE_TEST_DEPLOY_DIR
BITRISE_TEST_RESULT_DIR
BITRISE_TMP_DIR
BITRISE_XCHTML_REPORT_VERSION
EOF
}