Skip to content

Commit 34f9850

Browse files
authored
Fixed handling secrets in CI/CD build (#34)
* Fixed handling secrets in CI/CD build * Cleanup now additionally logs the database ID
1 parent 9067e7a commit 34f9850

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

.github/workflows/ci-cd.yml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
name: Checks
1616
needs: [ check-tag-version-job ]
1717
uses: ./.github/workflows/checks.yml
18+
secrets: inherit
1819

1920
cd-job:
2021
name: Continues Delivery

doc/changes/changes_0.3.0.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ This release adds integration tests for the most important calls to SaaS API.
1313

1414
* #14: Added fixture waiting until SaaS database is running
1515
* #25: Fixed transitive dependencies required by generated API client
16+
17+
## Bugfixes
18+
19+
* #34: Fixed handling secrets in CI/CD build

test/integration/api_access.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,18 @@ def database(
139139
yield db
140140
wait_for_delete_clearance(start)
141141
finally:
142+
db_repr = f"{db.name} with ID {db.id}"
142143
if db and not keep:
143-
LOG.info(f"Deleting database {db.name}")
144+
LOG.info(f"Deleting database {db_repr}")
144145
response = self.delete_database(db.id, ignore_delete_failure)
145146
if response.status_code == 200:
146-
LOG.info(f"Successfully deleted database {db.name}.")
147+
LOG.info(f"Successfully deleted database {db_repr}.")
147148
else:
148149
LOG.warning(f"Ignoring status code {response.status_code}.")
149150
elif not db:
150151
LOG.warning("Cannot delete db None")
151152
else:
152-
LOG.info(f"Keeping database {db.name} as keep = {keep}")
153+
LOG.info(f"Keeping database {db_repr} as keep = {keep}")
153154

154155
def get_database(self, database_id: str) -> openapi.models.database.Database:
155156
return get_database.sync(

test/integration/conftest.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,27 @@
99
timestamp_name,
1010
)
1111

12+
13+
def _env(var: str) -> str:
14+
result = os.environ.get(var)
15+
if result:
16+
return result
17+
raise RuntimeError(f"Environment variable {var} is empty.")
18+
19+
1220
@pytest.fixture(scope="session")
1321
def saas_host() -> str:
14-
return os.environ["SAAS_HOST"]
22+
return _env("SAAS_HOST")
1523

1624

1725
@pytest.fixture(scope="session")
1826
def saas_pat() -> str:
19-
return os.environ["SAAS_PAT"]
27+
return _env("SAAS_PAT")
2028

2129

2230
@pytest.fixture(scope="session")
2331
def saas_account_id() -> str:
24-
return os.environ["SAAS_ACCOUNT_ID"]
32+
return _env("SAAS_ACCOUNT_ID")
2533

2634

2735
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)