Skip to content

Commit 53be83f

Browse files
Integrate Azure Functions deployment
Signed-off-by: hancheng wang <wanghanchengchn@gmail.com> Integrate Azure Functions deployment Signed-off-by: hancheng wang <wanghanchengchn@gmail.com> Integrate Azure Functions deployment Signed-off-by: hancheng wang <wanghanchengchn@gmail.com>
1 parent 557e970 commit 53be83f

File tree

8 files changed

+16
-53
lines changed

8 files changed

+16
-53
lines changed

.github/workflows/azure_integration_test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
env:
2121
AZURE_APP_ID: ${{ secrets.AZURE_APP_ID }}
2222
AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }}
23-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
23+
AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
2424

2525
steps:
2626
- name: Check if environment variables are set # Validate secrets are passed
@@ -33,8 +33,8 @@ jobs:
3333
echo "AZURE_PASSWORD is not set. Please check if secrets.AZURE_PASSWORD is in the repository."
3434
exit 1
3535
fi
36-
if [[ -z "$AZURE_TENANT_ID" ]]; then
37-
echo "AZURE_TENANT_ID is not set. Please check if secrets.AZURE_TENANT_ID is in the repository."
36+
if [[ -z "$AZURE_TENANT" ]]; then
37+
echo "AZURE_TENANT is not set. Please check if secrets.AZURE_TENANT is in the repository."
3838
exit 1
3939
fi
4040
@@ -59,7 +59,7 @@ jobs:
5959
python-version: '3.10'
6060

6161
- name: Azure CLI Login Using Service Principal
62-
run: az login --service-principal --username "$AZURE_APP_ID" --password "$AZURE_PASSWORD" --tenant "$AZURE_TENANT_ID"
62+
run: az login --service-principal --username "$AZURE_APP_ID" --password "$AZURE_PASSWORD" --tenant "$AZURE_TENANT"
6363

6464
- name: Run Azure-related integration test
6565
run: go test -v ./pkg/driver/deployment/azure_functions_test.go

.github/workflows/e2e_azure.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
env:
2121
AZURE_APP_ID: ${{ secrets.AZURE_APP_ID }}
2222
AZURE_PASSWORD: ${{ secrets.AZURE_PASSWORD }}
23-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
23+
AZURE_TENANT: ${{ secrets.AZURE_TENANT }}
2424

2525
steps:
2626
- name: Check if environment variables are set # Validate secrets are passed
@@ -33,8 +33,8 @@ jobs:
3333
echo "AZURE_PASSWORD is not set. Please check if secrets.AZURE_PASSWORD is in the repository."
3434
exit 1
3535
fi
36-
if [[ -z "$AZURE_TENANT_ID" ]]; then
37-
echo "AZURE_TENANT_ID is not set. Please check if secrets.AZURE_TENANT_ID is in the repository."
36+
if [[ -z "$AZURE_TENANT" ]]; then
37+
echo "AZURE_TENANT is not set. Please check if secrets.AZURE_TENANT is in the repository."
3838
exit 1
3939
fi
4040
@@ -59,7 +59,7 @@ jobs:
5959
python-version: '3.10'
6060

6161
- name: Azure CLI Login Using Service Principal
62-
run: az login --service-principal --username "$AZURE_APP_ID" --password "$AZURE_PASSWORD" --tenant "$AZURE_TENANT_ID"
62+
run: az login --service-principal --username "$AZURE_APP_ID" --password "$AZURE_PASSWORD" --tenant "$AZURE_TENANT"
6363

6464
- name: Build and Run Loader
6565
run: go run cmd/loader.go --config cmd/config_azure_trace.json

.github/workflows/integration_tests.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ jobs:
3131
- uses: actions/setup-python@v5
3232
with:
3333
python-version: '3.9'
34-
35-
- name: Upgrade pip
36-
run: python3 -m pip install --upgrade pip
3734

3835
- uses: actions/cache@v4
3936
with:

.github/workflows/unit-tests.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ jobs:
4646
python-version: '3.9'
4747
env:
4848
PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org"
49-
50-
- name: Upgrade pip
51-
run: python3 -m pip install --upgrade pip
5249

5350
- uses: actions/cache@v4
5451
with:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# azurefunctionsconfig.yaml
22
azurefunctionsconfig:
33
resource_group: ExperimentResourceGroup # Name of the resource group
4-
storage_account_name: testinvitrostorage # Name of the storage account
5-
function_app_name: testinvitrofunctionapp # Name of the function app
4+
storage_account_name: invitroteststorage1 # Name of the storage account
5+
function_app_name: invitrotestfunctionapp # Name of the function app
66
location: EastUS # Region where resource created

docs/loader.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Note:
302302
```
303303
2. Use existing Service Principal credentials in order login to Azure.
304304
```bash
305-
az login --service-principal --username $AZURE_APP_ID --password $AZURE_PASSWORD --tenant $AZURE_TENANT_ID
305+
az login --service-principal --username $AZURE_APP_ID --password $AZURE_PASSWORD --tenant $AZURE_TENANT
306306
```
307307
> Refer to Note section for generation of Service Principal credentials
308308
3. Start the Azure Functions deployment experiment:
@@ -321,7 +321,7 @@ Notes:
321321
- Click **Register**
322322
3. Once registered, note down the following:
323323
- **Application (client) ID** → This is your `AZURE_APP_ID`
324-
- **Directory (tenant) ID** → This is your `AZURE_TENANT_ID`
324+
- **Directory (tenant) ID** → This is your `AZURE_TENANT`
325325
4. Click **Add a certificate or secret**
326326
- Click **+ New client secret**
327327
- Add a description and choose an expiry (e.g., 6 months)
@@ -338,7 +338,7 @@ Notes:
338338
```bash
339339
export AZURE_APP_ID=<appId>
340340
export AZURE_PASSWORD=<password>
341-
export AZURE_TENANT_ID=<tenant>
341+
export AZURE_TENANT=<tenant>
342342
```
343343
- Current deployment is via ZIP
344-
- Python is used for deployment workload as Go is not supported in Consumption Plan
344+
- Python is used for deployment workload as Go is not supported in Consumption Plan

pkg/driver/deployment/azure_functions.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -250,31 +250,6 @@ func SetORYXSettings(config *Config, functionAppName string) error {
250250

251251
/* Function to create folders and copy files to the folders */
252252

253-
// func CreateFunctionFolders(baseDir string, functions []*common.Function) error {
254-
// for i := 0; i < len(functions); i++ {
255-
// folderName := fmt.Sprintf("function%d", i)
256-
// folderPath := filepath.Join(baseDir, folderName)
257-
258-
// // Create the function folder
259-
// if err := os.MkdirAll(folderPath, os.ModePerm); err != nil {
260-
// return fmt.Errorf("failed to create folder %s: %w", folderPath, err)
261-
// }
262-
263-
// // Copy azurefunctionsworkload.py, exec_func.py and function.json into each function folder
264-
// if err := common.CopyFile("azurefunctions_setup/shared_azure_workload/azurefunctionsworkload.py", filepath.Join(folderPath, "azurefunctionsworkload.py")); err != nil {
265-
// return fmt.Errorf("failed to copy azurefunctionsworkload.py to %s: %w", folderPath, err)
266-
// }
267-
// if err := common.CopyFile("azurefunctions_setup/shared_azure_workload/exec_func.py", filepath.Join(folderPath, "exec_func.py")); err != nil {
268-
// return fmt.Errorf("failed to copy exec_func.py to %s: %w", folderPath, err)
269-
// }
270-
// if err := common.CopyFile("azurefunctions_setup/shared_azure_workload/function.json", filepath.Join(folderPath, "function.json")); err != nil {
271-
// return fmt.Errorf("failed to copy function.json to %s: %w", folderPath, err)
272-
// }
273-
// }
274-
// log.Debugf("Created %d function folders with copies of azurefunctionsworkload.py, exec_func.py and function.json under %s folder.\n", len(functions), baseDir)
275-
// return nil
276-
// }
277-
278253
func CreateFunctionFolders(baseDir, sharedWorkloadDir string, functions []*common.Function) error {
279254
for i := 0; i < len(functions); i++ {
280255
folderName := fmt.Sprintf("function%d", i)
@@ -345,13 +320,7 @@ func DeployFunctions(config *Config, baseDir string, functions []*common.Functio
345320
"--src", zipFilePath,
346321
"--build-remote", "true")
347322

348-
//var stdout, stderr bytes.Buffer // debugging output
349-
//cmd.Stdout = &stdout // debugging output
350-
//cmd.Stderr = &stderr // debugging output
351-
352323
if err := cmd.Run(); err != nil {
353-
//log.Errorf("Deployment stdout:\n%s", stdout.String()) // debugging output
354-
//log.Errorf("Deployment stderr:\n%s", stderr.String()) // debugging output
355324
return fmt.Errorf("failed to deploy %s to function app %s: %w", zipFilePath, functionAppName, err)
356325
}
357326

pkg/driver/deployment/azure_functions_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,11 @@ func setupAzureLogin(t *testing.T) {
245245

246246
appID := os.Getenv("AZURE_APP_ID")
247247
password := os.Getenv("AZURE_PASSWORD")
248-
tenantID := os.Getenv("AZURE_TENANT_ID")
248+
tenantID := os.Getenv("AZURE_TENANT")
249249

250250
require.NotEmpty(t, appID, "AZURE_APP_ID must be set")
251251
require.NotEmpty(t, password, "AZURE_PASSWORD must be set")
252-
require.NotEmpty(t, tenantID, "AZURE_TENANT_ID must be set")
252+
require.NotEmpty(t, tenantID, "AZURE_TENANT must be set")
253253

254254
cmd := exec.Command("az", "login",
255255
"--service-principal",

0 commit comments

Comments
 (0)