|
1 | 1 | # (C) 2021 GoodData Corporation |
| 2 | +# Load .env if it exists (staging secrets, gitignored) |
| 3 | +-include .env |
| 4 | + |
2 | 5 | # list all full paths to files and directories in CWD containing "gooddata", filter out ones ending by "client" |
3 | 6 | NO_CLIENT_GD_PROJECTS_ABS = $(filter-out %client, $(wildcard $(CURDIR)/packages/*gooddata*)) |
4 | 7 | # for each path, take only the base name of the path |
5 | 8 | NO_CLIENT_GD_PROJECTS_DIRS = $(foreach dir, $(NO_CLIENT_GD_PROJECTS_ABS), $(notdir $(dir))) |
6 | 9 | # TODO: replace API_VERSION in the future by call to API |
7 | 10 | API_VERSION="v1" |
8 | | -# Generate from localhost |
| 11 | +# Default: generate from localhost; use `make api-client STAGING=1` to download from remote |
| 12 | +ifdef STAGING |
| 13 | +BASE_URL="https://demo-cicd.cloud.gooddata.com" |
| 14 | +else |
9 | 15 | BASE_URL="http://localhost:3000" |
10 | | -# Generate from PROD |
11 | | -# BASE_URL="https://demo-cicd.cloud.gooddata.com" |
| 16 | +endif |
12 | 17 | URL="${BASE_URL}/api/${API_VERSION}/schemas" |
13 | 18 |
|
14 | 19 | include ci_tests.mk |
@@ -90,18 +95,21 @@ test: |
90 | 95 |
|
91 | 96 | .PHONY: test-staging |
92 | 97 | test-staging: |
93 | | - @test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make test-staging TOKEN=<api-token>" && exit 1) |
94 | | - $(MAKE) -C packages/gooddata-sdk test-staging TOKEN=$(TOKEN) |
| 98 | + @test -n "$(STAGING_ADMIN_TOKEN)" || (echo "ERROR: STAGING_ADMIN_TOKEN is required. Set it in .env or pass on CLI." && exit 1) |
| 99 | + @test -n "$(STAGING_DS_PASSWORD)" || (echo "ERROR: STAGING_DS_PASSWORD is required. Set it in .env or pass on CLI." && exit 1) |
| 100 | + $(MAKE) -C packages/gooddata-sdk test-staging TOKEN=$(STAGING_ADMIN_TOKEN) DS_PASSWORD=$(STAGING_DS_PASSWORD) |
95 | 101 |
|
96 | 102 | .PHONY: clean-staging |
97 | 103 | clean-staging: |
98 | | - @test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make clean-staging TOKEN=<api-token>" && exit 1) |
99 | | - cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python clean_staging.py |
| 104 | + @test -n "$(STAGING_ADMIN_TOKEN)" || (echo "ERROR: STAGING_ADMIN_TOKEN is required. Set it in .env or pass on CLI." && exit 1) |
| 105 | + @test -n "$(STAGING_DS_PASSWORD)" || (echo "ERROR: STAGING_DS_PASSWORD is required. Set it in .env or pass on CLI." && exit 1) |
| 106 | + cd packages/tests-support && STAGING=1 TOKEN="$(STAGING_ADMIN_TOKEN)" DS_PASSWORD="$(STAGING_DS_PASSWORD)" python clean_staging.py |
100 | 107 |
|
101 | 108 | .PHONY: load-staging |
102 | 109 | load-staging: |
103 | | - @test -n "$(TOKEN)" || (echo "ERROR: TOKEN is required. Usage: make load-staging TOKEN=<api-token>" && exit 1) |
104 | | - cd packages/tests-support && STAGING=1 TOKEN="$(TOKEN)" python upload_demo_layout.py |
| 110 | + @test -n "$(STAGING_ADMIN_TOKEN)" || (echo "ERROR: STAGING_ADMIN_TOKEN is required. Set it in .env or pass on CLI." && exit 1) |
| 111 | + @test -n "$(STAGING_DS_PASSWORD)" || (echo "ERROR: STAGING_DS_PASSWORD is required. Set it in .env or pass on CLI." && exit 1) |
| 112 | + cd packages/tests-support && STAGING=1 TOKEN="$(STAGING_ADMIN_TOKEN)" DS_PASSWORD="$(STAGING_DS_PASSWORD)" python upload_demo_layout.py |
105 | 113 |
|
106 | 114 | .PHONY: release |
107 | 115 | release: |
|
0 commit comments