-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CDF-22997] 🛡️ limit env replacement to loaders with auth/credentials (…
…#1155) * First pass introducing env replacement toggle * testin' * Testing that loaders with auth will replace env vars * more tests * testing replacements * regen'ed tests * testdata * ref * cleaner code
- Loading branch information
Showing
42 changed files
with
379 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/data/resources_with_environment_variables/modules/example_module/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# README.md | ||
|
||
This is an example of a custom module. It contains two TimeSeries with a dataset. |
4 changes: 4 additions & 0 deletions
4
...resources_with_environment_variables/modules/example_module/functions/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# cdf_functions_dummy | ||
|
||
This module is an example for how to define a simple function as a template in a tookit module. | ||
The functions can be found below the 'functions' folder, with one folder per function. |
22 changes: 22 additions & 0 deletions
22
...resources_with_environment_variables/modules/example_module/functions/first.Function.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# The dir with the function code should have the same name | ||
# and externalId as the function itself as defined below. | ||
- name: 'first:example:function' | ||
externalId: 'fn_first_function' | ||
owner: 'Anonymous' | ||
description: 'Returns the input data, secrets, and function info.' | ||
metadata: | ||
version: '1' | ||
secrets: | ||
mysecret: '${SOME_VARIABLE}' | ||
envVars: | ||
# The below two environment variables are set by the Toolkit | ||
ENV_TYPE: '${CDF_BUILD_TYPE}' | ||
CDF_ENV: '${CDF_ENVIRON}' | ||
# Number of cores, not available in Azure | ||
#cpu: 0.25 | ||
# Not available in Azure | ||
#memory: 1 | ||
runtime: 'py311' | ||
functionPath: './src/handler.py' | ||
# Data set id for the zip file with the code that is uploaded. | ||
dataSetExternalId: 'ds_timeseries_{{example_variable}}' |
14 changes: 14 additions & 0 deletions
14
...resources_with_environment_variables/modules/example_module/functions/first.Schedule.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
- name: "daily-8am-utc" | ||
functionExternalId: 'fn_first_function' | ||
description: "Run every day at 8am UTC" | ||
cronExpression: "0 8 * * *" | ||
data: | ||
breakfast: "today: peanut butter sandwich and coffee" | ||
lunch: "today: greek salad and water" | ||
dinner: "today: steak and red wine" | ||
authentication: | ||
# Credentials to use to run the function in this schedule. | ||
# In this example, we just use the main deploy credentials, so the result is the same, but use a different set of | ||
# credentials (env variables) if you want to run the function with different permissions. | ||
clientId: ${SOME_VARIABLE} | ||
clientSecret: ${ANOTHER_VARIABLE} |
6 changes: 6 additions & 0 deletions
6
...h_environment_variables/modules/example_module/functions/fn_first_function/arbitrary.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This is an arbitrary YAML file that is not a function config | ||
# It will be copied to the build directory as is | ||
mapping: | ||
key1: value1 | ||
key2: value2 | ||
key3: value3 |
Oops, something went wrong.