@toptal/davinci-ci 7.4.0 → 7.4.2-alpha-fx-xxx-fix-broken-ts-check-ea630a6d.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +7 -0
- package/package.json +4 -3
- package/src/configs/docker/Dockerfile.gha-deploy +0 -4
- package/src/configs/docker/env-runtime.entrypoint.sh +16 -2
- package/src/configs/docker/import-davinci-environment-file.sh +0 -31
- package/src/configs/docker/import-davinci-environment-file.test.sh +0 -56
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 7.4.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2380](https://github.com/toptal/davinci/pull/2380) [`262d4029`](https://github.com/toptal/davinci/commit/262d4029c66f284bd20ab4028d9a9c0fea31900a) Thanks [@sashuk](https://github.com/sashuk)!
|
8
|
+
- move env variables replacement into entrypoint script
|
9
|
+
|
3
10
|
## 7.4.0
|
4
11
|
|
5
12
|
### Minor Changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@toptal/davinci-ci",
|
3
|
-
"version": "7.4.0",
|
3
|
+
"version": "7.4.2-alpha-fx-xxx-fix-broken-ts-check-ea630a6d.0+ea630a6d",
|
4
4
|
"keywords": [
|
5
5
|
"ci",
|
6
6
|
"docker",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"dependencies": {
|
31
31
|
"@commitlint/cli": "^17.6.7",
|
32
32
|
"@commitlint/config-conventional": "^17.1.0",
|
33
|
-
"@toptal/davinci-cli-shared": "
|
33
|
+
"@toptal/davinci-cli-shared": "2.4.1-alpha-fx-xxx-fix-broken-ts-check-ea630a6d.6+ea630a6d",
|
34
34
|
"chalk": "^4.1.2",
|
35
35
|
"danger": "^11.2.2",
|
36
36
|
"markdown-table": "^2.0.0"
|
@@ -40,5 +40,6 @@
|
|
40
40
|
},
|
41
41
|
"publishConfig": {
|
42
42
|
"access": "public"
|
43
|
-
}
|
43
|
+
},
|
44
|
+
"gitHead": "ea630a6dc055a764ba461b2060a247b82c8de86f"
|
44
45
|
}
|
@@ -15,10 +15,6 @@ RUN [ -z "$ENV_RUNTIME_ENTRYPOINT" ] && echo "ENV_RUNTIME_ENTRYPOINT is required
|
|
15
15
|
COPY $ENV_RUNTIME_ENTRYPOINT /usr/local/bin/env-runtime.entrypoint.sh
|
16
16
|
RUN chmod +x /usr/local/bin/env-runtime.entrypoint.sh
|
17
17
|
|
18
|
-
# Copy script that reads .env file and replaces DAVINCI_* environment variables if they are empty
|
19
|
-
COPY ./davinci/packages/ci/src/configs/docker/import-davinci-environment-file.sh /usr/local/bin/import-davinci-environment-file.sh
|
20
|
-
RUN chmod +x /usr/local/bin/import-davinci-environment-file.sh
|
21
|
-
|
22
18
|
# version is used in build process, so the value won't be available here otherwise
|
23
19
|
ARG VERSION
|
24
20
|
RUN [ -z "$VERSION" ] && echo "VERSION is required" && exit 1 || true
|
@@ -16,8 +16,22 @@ VARS_PREFIX="DAVINCI_"
|
|
16
16
|
DIST_PATH="/usr/share/nginx/html"
|
17
17
|
INDEX_FILE="$DIST_PATH/index.html"
|
18
18
|
|
19
|
-
# import environment variables from .env.DAVINCI_ENV
|
20
|
-
|
19
|
+
# import environment variables from .env.DAVINCI_ENV files if there are any
|
20
|
+
ENV_FILE="$DIST_PATH/.env.$DAVINCI_ENV"
|
21
|
+
if [ -f "$ENV_FILE" ]; then
|
22
|
+
echo "Info: $ENV_FILE exists, importing variables..."
|
23
|
+
|
24
|
+
# Store current environment variables
|
25
|
+
OLD_ENV="$(export -p)"
|
26
|
+
|
27
|
+
# Load env file variables
|
28
|
+
export $(grep -v '^#' $ENV_FILE | xargs)
|
29
|
+
|
30
|
+
# Override env variables with previous values
|
31
|
+
eval "$OLD_ENV"
|
32
|
+
else
|
33
|
+
echo "Info: $ENV_FILE does not exist"
|
34
|
+
fi
|
21
35
|
|
22
36
|
VARS="$(env | grep $VARS_PREFIX | awk -F = '{print $1}')"
|
23
37
|
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#!/bin/sh -e
|
2
|
-
|
3
|
-
# Reads environment variables from .env.$DAVINCI_ENV file and overrides every empty
|
4
|
-
# variable in the existing environment
|
5
|
-
# See import-davinci-environment-file.test.sh for testing
|
6
|
-
|
7
|
-
if [ -z "$DAVINCI_ENV" ]; then
|
8
|
-
echo "Error: DAVINCI_ENV is empty"
|
9
|
-
exit 1
|
10
|
-
fi
|
11
|
-
|
12
|
-
if [ -z "$DIST_PATH" ]; then
|
13
|
-
echo "Error: DIST_PATH is empty"
|
14
|
-
exit 1
|
15
|
-
fi
|
16
|
-
|
17
|
-
ENV_FILE="$DIST_PATH/.env.$DAVINCI_ENV"
|
18
|
-
if [ -f "$ENV_FILE" ]; then
|
19
|
-
echo "Info: $ENV_FILE exists, importing variables..."
|
20
|
-
|
21
|
-
# Store current environment variables
|
22
|
-
OLD_ENV="$(export -p)"
|
23
|
-
|
24
|
-
# Load env file variables
|
25
|
-
export $(grep -v '^#' $ENV_FILE | xargs)
|
26
|
-
|
27
|
-
# Override env variables with previous values
|
28
|
-
eval "$OLD_ENV"
|
29
|
-
else
|
30
|
-
echo "Info: $ENV_FILE does not exist"
|
31
|
-
fi
|
@@ -1,56 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
|
3
|
-
# How to run test:
|
4
|
-
# - navigate to this folder in bash
|
5
|
-
# - run script "./import-davinci-environment-variables.test.sh", there should be no lines with "Assertion failed"
|
6
|
-
|
7
|
-
# Set up test environment
|
8
|
-
export TMP_PATH="./tmp"
|
9
|
-
mkdir -p "$TMP_PATH"
|
10
|
-
export DIST_PATH="$TMP_PATH"
|
11
|
-
|
12
|
-
# Set up console colors
|
13
|
-
RED='\033[0;31m'
|
14
|
-
NC='\033[0m'
|
15
|
-
|
16
|
-
############
|
17
|
-
# Test case:
|
18
|
-
# - EMPTY_VARIALBE_ABC value is replaced with value from .env.staging if the value in .env.staging is not empty
|
19
|
-
# - EMPTY_VARIALBE_DEF value stays empty as the value in .env.staging is empty
|
20
|
-
# - NON_EMPTY_VARIABLE value is not replaced with value from .env.staging
|
21
|
-
############
|
22
|
-
|
23
|
-
export DAVINCI_ENV="staging"
|
24
|
-
export NON_EMPTY_VARIABLE="123"
|
25
|
-
printf "%s\n" "EMPTY_VARIALBE_ABC=from-env-file" "EMPTY_VARIALBE_DEF=" "NON_EMPTY_VARIABLE=from-env-file" "RANDOM_VARIABLE=456" > "$DIST_PATH/.env.$DAVINCI_ENV"
|
26
|
-
|
27
|
-
set -a
|
28
|
-
source import-davinci-environment-file.sh
|
29
|
-
|
30
|
-
if [ "$EMPTY_VARIALBE_ABC" != "from-env-file" ]; then
|
31
|
-
echo -e "${RED}Assertion failed:${NC} EMPTY_VARIALBE_ABC is not equal to expected_value (received \"$EMPTY_VARIALBE_ABC\")"
|
32
|
-
exit 1
|
33
|
-
fi
|
34
|
-
|
35
|
-
if [ "$EMPTY_VARIALBE_DEF" != "" ]; then
|
36
|
-
echo -e "${RED}Assertion failed:${NC} EMPTY_VARIALBE_DEF is not equal to expected_value (received \"$EMPTY_VARIALBE_DEF\")"
|
37
|
-
exit 1
|
38
|
-
fi
|
39
|
-
|
40
|
-
if [ "$NON_EMPTY_VARIABLE" != "123" ]; then
|
41
|
-
echo -e "${RED}Assertion failed:${NC} NON_EMPTY_VARIABLE is not equal to expected_value"
|
42
|
-
exit 1
|
43
|
-
fi
|
44
|
-
|
45
|
-
# Clean up test environment
|
46
|
-
rm -rf "$TMP_PATH"
|
47
|
-
|
48
|
-
###########
|
49
|
-
# Test case: environment file does not exist
|
50
|
-
###########
|
51
|
-
command_output=$(source import-davinci-environment-file.sh)
|
52
|
-
|
53
|
-
if [ "$command_output" != "Info: $DIST_PATH/.env.$DAVINCI_ENV does not exist" ]; then
|
54
|
-
echo -e "${RED}Assertion failed:${NC} command_output is not equal to expected_value (received \"$command_output\")"
|
55
|
-
exit 1
|
56
|
-
fi
|