From 50a71d9600efb9aec275653adc38755e2767a4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Tue, 17 May 2022 22:57:06 +0200 Subject: [PATCH] add minimum files --- .drone.yml | 21 +++++++++++++++++++++ hanyadikhetvan/__init__.py | 10 ++++++++++ hanyadikhetvan/function.json | 19 +++++++++++++++++++ requirements.txt | 1 + 4 files changed, 51 insertions(+) create mode 100644 .drone.yml create mode 100644 hanyadikhetvan/__init__.py create mode 100644 hanyadikhetvan/function.json create mode 100644 requirements.txt diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..3666631 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,21 @@ +kind: pipeline +type: docker +name: Azure Function App + +steps: +- name: Build and upload function app + environment: + AZURE_SP: + from_secret: AZURE_SP + AZURE_SP_PASSWORD: + from_secret: AZURE_SP_PASSWORD + AZURE_SP_TENANT: + from_secret: AZURE_SP_TENANT + FUNCTION_APP_NAME: + from_secret: FUNCTION_APP_NAME + image: mcr.microsoft.com/azure-cli + commands: + - apk add npm + - npm i -g azure-functions-core-tools@3 --unsafe-perm true + - az login --service-principal -u $AZURE_SP -p $AZURE_SP_PASSWORD --tenant $AZURE_SP_TENANT + - func azure functionapp publish $FUNCTION_APP_NAME --python diff --git a/hanyadikhetvan/__init__.py b/hanyadikhetvan/__init__.py new file mode 100644 index 0000000..3b5a87a --- /dev/null +++ b/hanyadikhetvan/__init__.py @@ -0,0 +1,10 @@ +import logging +from datetime import date +import azure.functions as func + + +def main(req: func.HttpRequest) -> func.HttpResponse: + startdate = date(2022, 2, 6) + return func.HttpResponse( + (date.today() - startdate).days / 7, + status_code=200) diff --git a/hanyadikhetvan/function.json b/hanyadikhetvan/function.json new file mode 100644 index 0000000..8405ad4 --- /dev/null +++ b/hanyadikhetvan/function.json @@ -0,0 +1,19 @@ +{ + "scriptFile": "__init__.py", + "bindings": [ + { + "authLevel": "function", + "type": "httpTrigger", + "direction": "in", + "name": "req", + "methods": [ + "get" + ] + }, + { + "type": "http", + "direction": "out", + "name": "$return" + } + ] +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..75db2c4 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +azure-functions