1- step "deploy-with-cli " {
2- name = "Deploy to Consumption Function "
1+ step "open-firewall-port " {
2+ name = "Open FIrewall Port "
33
44 action {
55 action_type = "Octopus.AzurePowerShell"
6- environments = ["production"]
7- notes = "Deploy the application using the Azure Functions CLI"
86 properties = {
9- Octopus.Action.AutoRetry.MaximumCount = "3"
10- Octopus.Action.Azure.AccountId = "#{Octopus.Azure.Account}"
7+ Octopus.Action.Azure.AccountId = "azure-copilot"
118 Octopus.Action.Script.ScriptBody = <<-EOT
12- pushd Azure.Functions.Cli.linux-x64
13- chmod +x func
14- chmod +x gozip
15- popd
16-
179 # Grant access to this dynamic worker
1810 WORKERIP=$(curl --silent ifconfig.net/)
1911
@@ -34,6 +26,56 @@ step "deploy-with-cli" {
3426 # Allow this worker access
3527 az functionapp config access-restriction add -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker" --action Allow --ip-address ${WORKERIP} --priority 500
3628 az functionapp config access-restriction add -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker" --action Allow --ip-address ${WORKERIP} --priority 500 --slot "staging"
29+ EOT
30+ Octopus.Action.Script.ScriptSource = "Inline"
31+ Octopus.Action.Script.Syntax = "Bash"
32+ OctopusUseBundledTooling = "False"
33+ }
34+ worker_pool = "hosted-ubuntu"
35+
36+ container {
37+ feed = "ghcr"
38+ image = "ghcr.io/octopusdeploylabs/azure-workertools"
39+ }
40+ }
41+ }
42+
43+ step "deploy-with-cli" {
44+ name = "Deploy to Consumption Function"
45+
46+ action {
47+ action_type = "Octopus.AzurePowerShell"
48+ environments = ["production"]
49+ notes = "Deploy the application using the Azure Functions CLI"
50+ properties = {
51+ Octopus.Action.AutoRetry.MaximumCount = "3"
52+ Octopus.Action.Azure.AccountId = "#{Octopus.Azure.Account}"
53+ Octopus.Action.Script.ScriptBody = <<-EOT
54+ pushd Azure.Functions.Cli.linux-x64
55+ chmod +x func
56+ chmod +x gozip
57+ popd
58+
59+ # # Grant access to this dynamic worker
60+ # WORKERIP=$(curl --silent ifconfig.net/)
61+
62+
63+ # # Clear any existing rule
64+ # EXISTING=$(az functionapp config access-restriction show -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" | jq -r '[.ipSecurityRestrictions[] | select(.name=="dynamicworker")] | length')
65+ # if [[ $EXISTING -eq "1" ]]
66+ # then
67+ # az functionapp config access-restriction remove -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker"
68+ # fi
69+
70+ # EXISTING=$(az functionapp config access-restriction show -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --slot "staging" | jq -r '[.ipSecurityRestrictions[] | select(.name=="dynamicworker")] | length')
71+ # if [[ $EXISTING -eq "1" ]]
72+ # then
73+ # az functionapp config access-restriction remove -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker" --slot "staging"
74+ # fi
75+
76+ # # Allow this worker access
77+ # az functionapp config access-restriction add -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker" --action Allow --ip-address ${WORKERIP} --priority 500
78+ # az functionapp config access-restriction add -g "#{Azure.ResourceGroup.Name}" -n "#{Azure.Function.Name}" --rule-name "dynamicworker" --action Allow --ip-address ${WORKERIP} --priority 500 --slot "staging"
3779
3880
3981 # Disable autoswap
0 commit comments