Skip to content

Commit c30615f

Browse files
committed
Updated scripts to use azure.env in their own directory wherever they are used from
1 parent 3976f0f commit c30615f

File tree

9 files changed

+26
-13
lines changed

9 files changed

+26
-13
lines changed

.funcignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LICENSE
1414
jest.config.js
1515
*.example
1616
node_modules/.bin/
17-
*.sh
17+
scripts/
1818
*.env
1919
tsconfig.json
2020
src/

INSTALL.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ To get this Azure Function working, you need to:
1111

1212
> [!NOTE]
1313
> When working with the Azure CLI, remember to use `az login` to log in to Azure, and `az logout` first if you are having problems.
14-
>
15-
> To use the convenience scripts, set your Azure settings in a local `azure.env` file that they pick up. You may need to change settings if you want to vary the region the Function is used in, or change its name to allow more than one to coexist in the same subscription.
14+
15+
> [!NOTE]
16+
> To use the Bash (use WSL on Windows for Bash) scripts in the `scripts` directory, set your Azure settings in a `azure.env` file that they pick up from the same directory. You may need to change settings if you want to vary the region the Function is used in, or change its name to allow more than one to coexist in the same subscription.
1617
1718
## Creating a GitHub app
1819

@@ -78,7 +79,7 @@ This is left until the creation of the app using a manifest has been implemented
7879

7980
You need to create an Azure Function App, and deploy the Azure Function to it.
8081

81-
Before you deploy, set a `filter.yml` if you wish to filter out certain events. See [filtering events](README.md#filtering-events) for more details.
82+
Before you deploy, set a `filter.yml` if you wish to filter out certain events. See [filtering events](README.md) for more details.
8283

8384
### Creating the Functions App
8485

@@ -98,11 +99,11 @@ Fill in the details, and click on the "Review + create" button. Make sure you se
9899

99100
#### Creating the Functions App with the Azure CLI
100101

101-
It needs your subscription ID, a location, and a function app name to be set in `azure.env` in the repo directory.
102+
It needs your subscription ID, a location, and a function app name to be set in `scripts/azure.env` in the repo directory.
102103

103104
Only the subscription ID is necessary - the rest have defaults: you may want to change the region or the name of the function.
104105

105-
You can use the convenience script `create-azure-function.sh`.
106+
You can use the convenience script `scripts/create-azure-function.sh`.
106107

107108
#### Creating the Functions App with the VSCode Azure Functions extension
108109

scripts/create-function-app.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
# set Azure location to us-east unless it is set to something different already
810
AZURE_STORAGE_ACCOUNT="${AZURE_STORAGE_ACCOUNT:-teamssecretnotifier001sa}"

scripts/deploy-zip.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
./make-function-zip.sh
810

scripts/deploy.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
npm run build
810
func azure functionapp publish "${AZURE_FUNCTION_APP_NAME}" || echo "Failed to publish function app, try running 'az logout' then 'az login', then try again"

scripts/get-function-url.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
az account set --subscription "${AZURE_SUBSCRIPTION_ID}"
810
FUNCTIONS_APP_HOSTNAME=$(az functionapp show --resource-group "${AZURE_RESOURCE_GROUP}" --name "${AZURE_FUNCTION_APP_NAME}" --query "defaultHostName" --output tsv)

scripts/make-function-zip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ zip -q -r teams-secret-scanning-notifier.zip . \
1010
-x 'teams-secret-scanning-notifier.zip' '.vscode/*' '*settings*.json' \
1111
'.git/*' '.github/*' '.gitignore' '.eslint*' '.funcignore' '*.md' \
1212
'CODEOWNERS' 'LICENSE' '*.ts' '*.map' 'jest.config.js' \
13-
'*.example' 'node_modules/.bin/*' '*.sh' '*.env' \
13+
'*.example' 'node_modules/.bin/*' 'scripts/*' '*.env' \
1414
'tsconfig.json' 'src/*' 'test/*' \
1515
'node_modules/@types/*' 'node_modules/*jest*/*' \
1616
'node_modules/*eslint*/*' '*/.github/*' '*/.history/*' \

scripts/sync-settings-local-to-remote.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
az account set --subscription "${AZURE_SUBSCRIPTION_ID}"
810

scripts/sync-settings-remote-to-local.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -euo pipefail
44

5-
. ./azure.env
5+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
6+
7+
. "${SCRIPT_DIR}"/azure.env
68

79
az account set --subscription "${AZURE_SUBSCRIPTION_ID}"
810

0 commit comments

Comments
 (0)