Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mirror sdk and extension branches #1554

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions eng/ci/code-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ trigger:
include:
- dev
- release/*
- sdk/* # run for sdk and extension release branches
- extensions/*

resources:
repositories:
Expand Down
7 changes: 6 additions & 1 deletion eng/ci/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
trigger: none # ensure this is not ran as a CI build
trigger: # run for sdk and extension release branches
batch: true
branches:
include:
- sdk/*
- extensions/*

pr:
branches:
Expand Down
8 changes: 8 additions & 0 deletions eng/ci/public-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ trigger:
branches:
include:
- dev
- sdk/*
- extensions/*

pr:
branches:
Expand All @@ -24,6 +26,12 @@ resources:
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

variables:
- name: isSdkRelease
value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/sdk/')]
- name: isExtensionsRelease
value: $[startsWith(variables['Build.SourceBranch'], 'refs/heads/extensions/')]

extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1es
parameters:
Expand Down
13 changes: 13 additions & 0 deletions eng/scripts/test-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

python -m pip install --upgrade pip
if [[ $2 != "3.7" ]]; then
python -m pip install -e $1/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $2 != "3.7" && $2 != "3.8" ]]; then
python -m pip install -e $1/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-deferred-bindings]
fi

python -m pip install -U -e .[dev]
12 changes: 12 additions & 0 deletions eng/scripts/test-sdk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

python -m pip install --upgrade pip
python -m pip install -e $1/PythonSdkArtifact
python -m pip install -U -e .[dev]

if [[ $2 != "3.7" ]]; then
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $2 != "3.7" && $2 != "3.8" ]]; then
python -m pip install --pre -U -e .[test-deferred-bindings]
fi
37 changes: 37 additions & 0 deletions eng/templates/jobs/ci-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,43 @@ jobs:
eng/scripts/install-dependencies.sh $(PYTHON_VERSION)
eng/scripts/test-setup.sh
displayName: 'Install dependencies'
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- task: DownloadPipelineArtifact@2
displayName: 'Download Python SDK Artifact'
inputs:
buildType: specific
artifactName: 'azure-functions'
project: 'internal'
definition: 679
buildVersionToDownload: latest
targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
- bash: |
chmod +x eng/scripts/test-sdk.sh
chmod +x eng/scripts/test-setup.sh

eng/scripts/test-sdk.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
eng/scripts/test-setup.sh
displayName: 'Install test python sdk, dependencies and the worker'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
- task: DownloadPipelineArtifact@2
displayName: 'Download Python Extension Artifact'
inputs:
buildType: specific
artifactName: $(PYTHONEXTENSIONNAME)
project: 'internal'
definition: 798
buildVersionToDownload: latest
targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
- bash: |
chmod +x eng/scripts/test-setup.sh
chmod +x eng/scripts/test-extensions.sh

eng/scripts/test-extensions.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
eng/scripts/test-setup.sh
displayName: 'Install test python extension, dependencies and the worker'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
- bash: |
python -m pytest -q -n auto --dist loadfile --reruns 4 --instafail --cov=./azure_functions_worker --cov-report xml --cov-branch tests/unittests
displayName: "Running $(PYTHON_VERSION) Unit Tests"
Expand Down
31 changes: 6 additions & 25 deletions eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,10 @@ jobs:
targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
- bash: |
python -m pip install --upgrade pip
python -m pip install -e $(Pipeline.Workspace)/PythonSdkArtifact
python -m pip install -U -e .[dev]

if [[ $(PYTHON_VERSION) != "3.7" ]]; then
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then
python -m pip install --pre -U -e .[test-deferred-bindings]
fi

chmod +x eng/scripts/test-sdk.sh
chmod +x eng/scripts/test-setup.sh

eng/scripts/test-sdk.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
eng/scripts/test-setup.sh
displayName: 'Install test python sdk, dependencies and the worker'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
Expand All @@ -116,21 +108,10 @@ jobs:
targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
- bash: |
python -m pip install --upgrade pip

if [[ $(PYTHON_VERSION) != "3.7" ]]; then
python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then
python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-deferred-bindings]
fi

python -m pip install -U -e .[dev]


chmod +x eng/scripts/test-setup.sh
chmod +x eng/scripts/test-extensions.sh

eng/scripts/test-extensions.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
eng/scripts/test-setup.sh
displayName: 'Install test python extension, dependencies and the worker'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
Expand Down
3 changes: 2 additions & 1 deletion eng/templates/official/jobs/ci-lc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ jobs:
env:
AzureWebJobsStorage: $(LinuxStorageConnectionString312)
_DUMMY_CONT_KEY: $(_DUMMY_CONT_KEY)
displayName: "Running $(PYTHON_VERSION) Linux Consumption tests"
displayName: "Running $(PYTHON_VERSION) Linux Consumption tests"
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)


@app.function_name(name="get_bc_blob_triggered")
@app.function_name(name="get_bc_blob_triggered_dual")
@app.blob_input(arg_name="client",
path="python-worker-tests/test-blobclient-triggered.txt",
connection="AzureWebJobsStorage")
@app.route(route="get_bc_blob_triggered")
def get_bc_blob_triggered(req: func.HttpRequest,
client: blob.BlobClient) -> str:
@app.route(route="get_bc_blob_triggered_dual")
def get_bc_blob_triggered_dual(req: func.HttpRequest,
client: blob.BlobClient) -> str:
return client.download_blob(encoding='utf-8').readall()


@app.function_name(name="blob_trigger")
@app.function_name(name="blob_trigger_dual")
@app.blob_trigger(arg_name="file",
path="python-worker-tests/test-blob-trigger.txt",
connection="AzureWebJobsStorage")
@app.blob_output(arg_name="$return",
path="python-worker-tests/test-blob-triggered.txt",
connection="AzureWebJobsStorage")
def blob_trigger(file: func.InputStream) -> str:
def blob_trigger_dual(file: func.InputStream) -> str:
return json.dumps({
'name': file.name,
'length': file.length,
Expand Down
Loading