├── .gitignore ├── Formula ├── azure-functions-core-tools-v3-preview.rb ├── azure-functions-core-tools.rb ├── azure-functions-core-tools@2.rb ├── azure-functions-core-tools@3.rb └── azure-functions-core-tools@4.rb ├── LICENSE ├── README.md ├── SECURITY.md ├── azure-pipelines.yml ├── eng └── ci │ ├── code-mirror.yml │ ├── official-build.yml │ ├── public-build.yml │ └── templates │ ├── official │ └── jobs │ │ ├── test-linux.yml │ │ └── test-mac.yml │ └── public │ └── jobs │ └── test-linux-public.yml ├── test.ps1 └── update.ps1 /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | /.config 4 | /coverage/ 5 | /InstalledFiles 6 | /pkg/ 7 | /spec/reports/ 8 | /spec/examples.txt 9 | /test/tmp/ 10 | /test/version_tmp/ 11 | /tmp/ 12 | 13 | # Used by dotenv library to load environment variables. 14 | # .env 15 | 16 | ## Specific to RubyMotion: 17 | .dat* 18 | .repl_history 19 | build/ 20 | *.bridgesupport 21 | build-iPhoneOS/ 22 | build-iPhoneSimulator/ 23 | 24 | ## Specific to RubyMotion (use of CocoaPods): 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 29 | # 30 | # vendor/Pods/ 31 | 32 | ## Documentation cache and generated files: 33 | /.yardoc/ 34 | /_yardoc/ 35 | /doc/ 36 | /rdoc/ 37 | 38 | ## Environment normalization: 39 | /.bundle/ 40 | /vendor/bundle 41 | /lib/bundler/man/ 42 | 43 | # for a library or gem, you might want to ignore these files since the code is 44 | # intended to run in multiple environments; otherwise, check them in: 45 | # Gemfile.lock 46 | # .ruby-version 47 | # .ruby-gemset 48 | 49 | # unless supporting rvm < 1.11.0 or doing something fancy, ignore this: 50 | .rvmrc 51 | -------------------------------------------------------------------------------- /Formula/azure-functions-core-tools-v3-preview.rb: -------------------------------------------------------------------------------- 1 | class AzureFunctionsCoreToolsV3Preview < Formula 2 | funcVersion = "3.0.5682" 3 | if OS.linux? 4 | funcArch = "linux-x64" 5 | funcSha = "5b5536d11171c22bc983123f2a54b04581dc2e0923f09335a6e61d7029a74f12" 6 | else 7 | funcArch = "osx-x64" 8 | funcSha = "bc7aa0bec5e652b7e70ecddd5dcc1a2306ee88297424276bd78e253b02b246c2" 9 | end 10 | 11 | desc "Azure Functions Core Tools 3.0" 12 | homepage "https://docs.microsoft.com/azure/azure-functions/functions-run-local#run-azure-functions-core-tools" 13 | url "https://cdn.functions.azure.com/public/#{funcVersion}/Azure.Functions.Cli.#{funcArch}.#{funcVersion}.zip" 14 | sha256 funcSha 15 | version funcVersion 16 | head "https://github.com/Azure/azure-functions-core-tools" 17 | 18 | @@telemetry = "\n Telemetry \n --------- \n The Azure Functions Core tools collect usage data in order to help us improve your experience." \ 19 | + "\n The data is anonymous and doesn\'t include any user specific or personal information. The data is collected by Microsoft." \ 20 | + "\n \n You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to \'1\' or \'true\' using your favorite shell.\n" 21 | 22 | def install 23 | prefix.install Dir["*"] 24 | chmod 0555, prefix/"func" 25 | chmod 0555, prefix/"gozip" 26 | bin.install_symlink prefix/"func" 27 | begin 28 | FileUtils.touch(prefix/"telemetryDefaultOn.sentinel") 29 | print @@telemetry 30 | rescue Exception 31 | end 32 | end 33 | 34 | test do 35 | assert_match version.to_s, shell_output("#{bin}/func") 36 | system bin/"func", "new", "-l", "C#", "-t", "HttpTrigger", "-n", "confusedDevTest" 37 | assert_predicate testpath/"confusedDevTest/function.json", :exist? 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /Formula/azure-functions-core-tools.rb: -------------------------------------------------------------------------------- 1 | class AzureFunctionsCoreTools < Formula 2 | funcVersion = "2.7.3188" 3 | if OS.linux? 4 | funcArch = "linux-x64" 5 | funcSha = "f8cff611d0cc2198589a7ff0b1b268549bf86c11afd799098df59f7721d6b771" 6 | else 7 | funcArch = "osx-x64" 8 | funcSha = "baa850c449e9be5fcef8e2bf91883885ec9ab9471437c998701435f5164d72e5" 9 | end 10 | 11 | desc "Azure Functions Core Tools 2.0" 12 | homepage "https://docs.microsoft.com/azure/azure-functions/functions-run-local#run-azure-functions-core-tools" 13 | url "https://cdn.functions.azure.com/public/#{funcVersion}/Azure.Functions.Cli.#{funcArch}.#{funcVersion}.zip" 14 | sha256 funcSha 15 | version funcVersion 16 | head "https://github.com/Azure/azure-functions-core-tools" 17 | 18 | @@telemetry = "\n Telemetry \n --------- \n The Azure Functions Core tools collect usage data in order to help us improve your experience." \ 19 | + "\n The data is anonymous and doesn\'t include any user specific or personal information. The data is collected by Microsoft." \ 20 | + "\n \n You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to \'1\' or \'true\' using your favorite shell.\n" 21 | 22 | def install 23 | prefix.install Dir["*"] 24 | chmod 0555, prefix/"func" 25 | chmod 0555, prefix/"gozip" 26 | bin.install_symlink prefix/"func" 27 | begin 28 | FileUtils.touch(prefix/"telemetryDefaultOn.sentinel") 29 | print @@telemetry 30 | rescue Exception 31 | end 32 | end 33 | 34 | test do 35 | assert_match version.to_s, shell_output("#{bin}/func") 36 | system bin/"func", "new", "-l", "C#", "-t", "HttpTrigger", "-n", "confusedDevTest" 37 | assert_predicate testpath/"confusedDevTest/function.json", :exist? 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /Formula/azure-functions-core-tools@2.rb: -------------------------------------------------------------------------------- 1 | class AzureFunctionsCoreToolsAT2 < Formula 2 | funcVersion = "2.7.3188" 3 | if OS.linux? 4 | funcArch = "linux-x64" 5 | funcSha = "f8cff611d0cc2198589a7ff0b1b268549bf86c11afd799098df59f7721d6b771" 6 | else 7 | funcArch = "osx-x64" 8 | funcSha = "baa850c449e9be5fcef8e2bf91883885ec9ab9471437c998701435f5164d72e5" 9 | end 10 | 11 | desc "Azure Functions Core Tools 2.0" 12 | homepage "https://docs.microsoft.com/azure/azure-functions/functions-run-local#run-azure-functions-core-tools" 13 | url "https://cdn.functions.azure.com/public/#{funcVersion}/Azure.Functions.Cli.#{funcArch}.#{funcVersion}.zip" 14 | sha256 funcSha 15 | version funcVersion 16 | head "https://github.com/Azure/azure-functions-core-tools" 17 | 18 | @@telemetry = "\n Telemetry \n --------- \n The Azure Functions Core tools collect usage data in order to help us improve your experience." \ 19 | + "\n The data is anonymous and doesn\'t include any user specific or personal information. The data is collected by Microsoft." \ 20 | + "\n \n You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to \'1\' or \'true\' using your favorite shell.\n" 21 | 22 | def install 23 | prefix.install Dir["*"] 24 | chmod 0555, prefix/"func" 25 | chmod 0555, prefix/"gozip" 26 | bin.install_symlink prefix/"func" 27 | begin 28 | FileUtils.touch(prefix/"telemetryDefaultOn.sentinel") 29 | print @@telemetry 30 | rescue Exception 31 | end 32 | end 33 | 34 | test do 35 | assert_match version.to_s, shell_output("#{bin}/func") 36 | system bin/"func", "new", "-l", "C#", "-t", "HttpTrigger", "-n", "confusedDevTest" 37 | assert_predicate testpath/"confusedDevTest/function.json", :exist? 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /Formula/azure-functions-core-tools@3.rb: -------------------------------------------------------------------------------- 1 | class AzureFunctionsCoreToolsAT3 < Formula 2 | funcVersion = "3.0.5682" 3 | if OS.linux? 4 | funcArch = "linux-x64" 5 | funcSha = "5b5536d11171c22bc983123f2a54b04581dc2e0923f09335a6e61d7029a74f12" 6 | else 7 | funcArch = "osx-x64" 8 | funcSha = "bc7aa0bec5e652b7e70ecddd5dcc1a2306ee88297424276bd78e253b02b246c2" 9 | end 10 | 11 | desc "Azure Functions Core Tools 3.0" 12 | homepage "https://docs.microsoft.com/azure/azure-functions/functions-run-local#run-azure-functions-core-tools" 13 | url "https://cdn.functions.azure.com/public/#{funcVersion}/Azure.Functions.Cli.#{funcArch}.#{funcVersion}.zip" 14 | sha256 funcSha 15 | version funcVersion 16 | head "https://github.com/Azure/azure-functions-core-tools" 17 | 18 | @@telemetry = "\n Telemetry \n --------- \n The Azure Functions Core tools collect usage data in order to help us improve your experience." \ 19 | + "\n The data is anonymous and doesn\'t include any user specific or personal information. The data is collected by Microsoft." \ 20 | + "\n \n You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to \'1\' or \'true\' using your favorite shell.\n" 21 | 22 | def install 23 | prefix.install Dir["*"] 24 | chmod 0555, prefix/"func" 25 | chmod 0555, prefix/"gozip" 26 | bin.install_symlink prefix/"func" 27 | begin 28 | FileUtils.touch(prefix/"telemetryDefaultOn.sentinel") 29 | print @@telemetry 30 | rescue Exception 31 | end 32 | end 33 | 34 | test do 35 | assert_match version.to_s, shell_output("#{bin}/func") 36 | system bin/"func", "new", "-l", "C#", "-t", "HttpTrigger", "-n", "confusedDevTest" 37 | assert_predicate testpath/"confusedDevTest/function.json", :exist? 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /Formula/azure-functions-core-tools@4.rb: -------------------------------------------------------------------------------- 1 | class AzureFunctionsCoreToolsAT4 < Formula 2 | funcVersion = "4.0.7317" 3 | consolidatedBuildId = "219577" 4 | if OS.linux? 5 | funcArch = "linux-x64" 6 | funcSha = "c0f931e44bb30d3a8960b86e0b6ab1ff09c940fa186d1c2d73e10f72ecb83a2e" 7 | elsif Hardware::CPU.arm? 8 | funcArch = "osx-arm64" 9 | funcSha = "3dfe2076f78439b086bd6d3b31ea9a2d7e175ee8b8f7b2c26250fad0149f92fc" 10 | else 11 | funcArch = "osx-x64" 12 | funcSha = "d12777795219b523ba46d1089ad2652dc21b57a9c524e30041c99577ccec2dc7" 13 | end 14 | 15 | desc "Azure Functions Core Tools 4.0" 16 | homepage "https://docs.microsoft.com/azure/azure-functions/functions-run-local#run-azure-functions-core-tools" 17 | url "https://cdn.functions.azure.com/public/4.0.#{consolidatedBuildId}/Azure.Functions.Cli.#{funcArch}.#{funcVersion}.zip" 18 | sha256 funcSha 19 | version funcVersion 20 | head "https://github.com/Azure/azure-functions-core-tools" 21 | 22 | 23 | @@telemetry = "\n Telemetry \n --------- \n The Azure Functions Core tools collect usage data in order to help us improve your experience." \ 24 | + "\n The data is anonymous and doesn\'t include any user specific or personal information. The data is collected by Microsoft." \ 25 | + "\n \n You can opt-out of telemetry by setting the FUNCTIONS_CORE_TOOLS_TELEMETRY_OPTOUT environment variable to \'1\' or \'true\' using your favorite shell.\n" 26 | 27 | def install 28 | prefix.install Dir["*"] 29 | chmod 0555, prefix/"func" 30 | chmod 0555, prefix/"gozip" 31 | bin.install_symlink prefix/"func" 32 | begin 33 | FileUtils.touch(prefix/"telemetryDefaultOn.sentinel") 34 | print @@telemetry 35 | rescue Exception 36 | end 37 | end 38 | 39 | test do 40 | assert_match version.to_s, shell_output("#{bin}/func") 41 | system bin/"func", "new", "-l", "C#", "-t", "HttpTrigger", "-n", "confusedDevTest" 42 | assert_predicate testpath/"confusedDevTest/function.json", :exist? 43 | end 44 | end 45 | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Azure Functions Logo](https://raw.githubusercontent.com/Azure/azure-functions-cli/master/src/Azure.Functions.Cli/npm/assets/azure-functions-logo-color-raster.png) 2 | 3 | ```bash 4 | brew tap azure/functions 5 | brew install azure-functions-core-tools@4 6 | ``` 7 | 8 | # Contributing 9 | 10 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 11 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 12 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 13 | 14 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 15 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 16 | provided by the bot. You will only need to do this once across all repos using our CLA. 17 | 18 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 19 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 20 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 21 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | pr: 2 | branches: 3 | include: 4 | - master 5 | 6 | trigger: 7 | - master 8 | 9 | jobs: 10 | - job: Test 11 | strategy: 12 | matrix: 13 | Mac_v4: 14 | ImageType: 'macOS-latest' 15 | FileSuffix: '@4' 16 | MajorVersion: '4' 17 | Mac_v3: 18 | ImageType: 'macOS-latest' 19 | FileSuffix: '@3' 20 | MajorVersion: '3' 21 | Mac_v3_legacy: 22 | ImageType: 'macOS-latest' 23 | FileSuffix: '-v3-preview' 24 | MajorVersion: '3' 25 | Mac_v2: 26 | ImageType: 'macOS-latest' 27 | FileSuffix: '@2' 28 | MajorVersion: '2' 29 | Mac_v2_legacy: 30 | ImageType: 'macOS-latest' 31 | FileSuffix: '' 32 | MajorVersion: '2' 33 | Linux_v4: 34 | ImageType: 'ubuntu-latest' 35 | FileSuffix: '@4' 36 | MajorVersion: '4' 37 | Linux_v3: 38 | ImageType: 'ubuntu-latest' 39 | FileSuffix: '@3' 40 | MajorVersion: '3' 41 | Linux_v3_legacy: 42 | ImageType: 'ubuntu-latest' 43 | FileSuffix: '-v3-preview' 44 | MajorVersion: '3' 45 | Linux_v2: 46 | ImageType: 'ubuntu-latest' 47 | FileSuffix: '@2' 48 | MajorVersion: '2' 49 | Linux_v2_legacy: 50 | ImageType: 'ubuntu-latest' 51 | FileSuffix: '' 52 | MajorVersion: '2' 53 | pool: 54 | vmImage: $(ImageType) 55 | steps: 56 | - script: echo "##vso[task.prependpath]/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin:/usr/local/bin" 57 | displayName: 'Add brew to path' 58 | condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) 59 | - pwsh: ./test.ps1 -MajorVersion "$(MajorVersion)" -FileSuffix "$(FileSuffix)" 60 | displayName: 'Test brew formula' -------------------------------------------------------------------------------- /eng/ci/code-mirror.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | branches: 3 | include: 4 | # Below branches are examples for Azure/azure-functions-host. Replace with appropriate branches for your repository. 5 | # Keep this set limited as appropriate (don't mirror individual user branches). 6 | - master 7 | 8 | resources: 9 | repositories: 10 | - repository: eng 11 | type: git 12 | name: engineering 13 | ref: refs/tags/release 14 | 15 | variables: 16 | - template: ci/variables/cfs.yml@eng 17 | 18 | extends: 19 | template: ci/code-mirror.yml@eng 20 | -------------------------------------------------------------------------------- /eng/ci/official-build.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Nightly Build 4 | branches: 5 | include: 6 | - master 7 | always: true 8 | 9 | name: $(Build.SourceBranchName)_$(Build.Reason) 10 | 11 | pr: none 12 | 13 | trigger: 14 | branches: 15 | include: 16 | - master 17 | 18 | resources: 19 | repositories: 20 | - repository: 1es 21 | type: git 22 | name: 1ESPipelineTemplates/1ESPipelineTemplates 23 | ref: refs/tags/release 24 | - repository: eng 25 | type: git 26 | name: engineering 27 | ref: refs/tags/release 28 | 29 | variables: 30 | - template: /ci/variables/cfs.yml@eng 31 | 32 | extends: 33 | template: v1/1ES.Official.PipelineTemplate.yml@1es 34 | parameters: 35 | pool: 36 | name: 1es-pool-azfunc 37 | image: 1es-windows-2022 38 | os: windows 39 | stages: 40 | - stage: BuildAndTest 41 | jobs: 42 | - template: /eng/ci/templates/official/jobs/test-mac.yml@self 43 | - template: /eng/ci/templates/official/jobs/test-linux.yml@self 44 | 45 | 46 | -------------------------------------------------------------------------------- /eng/ci/public-build.yml: -------------------------------------------------------------------------------- 1 | schedules: 2 | - cron: "0 0 * * *" 3 | displayName: Nightly Build 4 | branches: 5 | include: 6 | - master 7 | always: true 8 | 9 | name: $(Build.SourceBranchName)_$(Build.Reason) 10 | 11 | pr: 12 | branches: 13 | include: 14 | - master 15 | 16 | trigger: 17 | batch: true 18 | branches: 19 | include: 20 | - master 21 | 22 | resources: 23 | repositories: 24 | - repository: 1es 25 | type: git 26 | name: 1ESPipelineTemplates/1ESPipelineTemplates 27 | ref: refs/tags/release 28 | 29 | extends: 30 | template: v1/1ES.Unofficial.PipelineTemplate.yml@1es 31 | parameters: 32 | pool: 33 | name: 1es-pool-azfunc-public 34 | image: 1es-windows-2022 35 | os: windows 36 | sdl: 37 | codeql: 38 | compiled: 39 | enabled: true 40 | runSourceLanguagesInSourceAnalysis: true 41 | stages: 42 | - stage: Test 43 | jobs: 44 | - template: /eng/ci/templates/official/jobs/test-mac.yml@self 45 | - template: /eng/ci/templates/public/jobs/test-linux-public.yml@self 46 | 47 | -------------------------------------------------------------------------------- /eng/ci/templates/official/jobs/test-linux.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: LinuxTest 3 | strategy: 4 | matrix: 5 | Linux_v4: 6 | FileSuffix: '@4' 7 | MajorVersion: '4' 8 | Linux_v3: 9 | FileSuffix: '@3' 10 | MajorVersion: '3' 11 | Linux_v3_legacy: 12 | FileSuffix: '-v3-preview' 13 | MajorVersion: '3' 14 | Linux_v2: 15 | FileSuffix: '@2' 16 | MajorVersion: '2' 17 | Linux_v2_legacy: 18 | FileSuffix: '' 19 | MajorVersion: '2' 20 | pool: 21 | name: 1es-pool-azfunc 22 | image: 1es-ubuntu-22.04 23 | os: linux 24 | steps: 25 | - script: echo "##vso[task.prependpath]/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin:/usr/local/bin" 26 | displayName: 'Add brew to path' 27 | condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) 28 | - pwsh: ./test.ps1 -MajorVersion "$(MajorVersion)" -FileSuffix "$(FileSuffix)" 29 | displayName: 'Test brew formula' -------------------------------------------------------------------------------- /eng/ci/templates/official/jobs/test-mac.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: MacTest 3 | strategy: 4 | matrix: 5 | Mac_v4: 6 | FileSuffix: '@4' 7 | MajorVersion: '4' 8 | Mac_v3: 9 | FileSuffix: '@3' 10 | MajorVersion: '3' 11 | Mac_v3_legacy: 12 | FileSuffix: '-v3-preview' 13 | MajorVersion: '3' 14 | Mac_v2: 15 | FileSuffix: '@2' 16 | MajorVersion: '2' 17 | Mac_v2_legacy: 18 | FileSuffix: '' 19 | MajorVersion: '2' 20 | pool: 21 | name: Azure Pipelines 22 | image: 'macOS-latest' 23 | os: macOS 24 | steps: 25 | - script: echo "##vso[task.prependpath]/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin:/usr/local/bin" 26 | displayName: 'Add brew to path' 27 | condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) 28 | - pwsh: ./test.ps1 -MajorVersion "$(MajorVersion)" -FileSuffix "$(FileSuffix)" 29 | displayName: 'Test brew formula' -------------------------------------------------------------------------------- /eng/ci/templates/public/jobs/test-linux-public.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - job: LinuxTest 3 | strategy: 4 | matrix: 5 | Linux_v4: 6 | FileSuffix: '@4' 7 | MajorVersion: '4' 8 | Linux_v3: 9 | FileSuffix: '@3' 10 | MajorVersion: '3' 11 | Linux_v3_legacy: 12 | FileSuffix: '-v3-preview' 13 | MajorVersion: '3' 14 | Linux_v2: 15 | FileSuffix: '@2' 16 | MajorVersion: '2' 17 | Linux_v2_legacy: 18 | FileSuffix: '' 19 | MajorVersion: '2' 20 | pool: 21 | name: 1es-pool-azfunc-public 22 | image: 1es-ubuntu-22.04 23 | os: linux 24 | steps: 25 | - script: echo "##vso[task.prependpath]/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin:/usr/local/bin" 26 | displayName: 'Add brew to path' 27 | condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) 28 | - pwsh: ./test.ps1 -MajorVersion "$(MajorVersion)" -FileSuffix "$(FileSuffix)" 29 | displayName: 'Test brew formula' -------------------------------------------------------------------------------- /test.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [Parameter(Mandatory=$true)] 3 | [ValidateNotNullOrEmpty()] 4 | [string] 5 | $MajorVersion, 6 | 7 | [Parameter(Mandatory=$true)] 8 | [AllowEmptyString()] 9 | [string] 10 | $FileSuffix 11 | ) 12 | 13 | brew tap azure/functions 14 | if (-not $?) { exit 1 } 15 | 16 | brew install "./Formula/azure-functions-core-tools$FileSuffix.rb" 17 | if (-not $?) { exit 1 } 18 | 19 | $funcOutput = func --version 20 | if (-not $?) { exit 1 } 21 | 22 | $actualMajorVersion = ([version]$funcOutput.trim()).Major 23 | if ($actualMajorVersion -ne $MajorVersion) { 24 | Write-Error "Expected: ""$MajorVersion"", Actual ""$actualMajorVersion""" 25 | exit 1 26 | } else { 27 | Write-Output "func installed and version matched! 🎉" 28 | } 29 | -------------------------------------------------------------------------------- /update.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [Parameter(Mandatory=$true)] 3 | [ValidateNotNullOrEmpty()] 4 | [string] $artifactsDirectoryRoot, 5 | 6 | [Parameter(Mandatory=$true)] 7 | [ValidateNotNullOrEmpty()] 8 | [string] $version, 9 | 10 | [Parameter(Mandatory=$true)] 11 | [ValidateNotNullOrEmpty()] 12 | [string] $consolidatedBuildId 13 | ) 14 | 15 | function updateFormula([string]$fileSuffix) { 16 | $filePath = "./Formula/azure-functions-core-tools$fileSuffix.rb" 17 | $content = Get-Content $filePath -Raw 18 | 19 | # Update version 20 | if ($content -match 'funcVersion = "(.*)"') { 21 | $oldVersion = $Matches.1 22 | $content = $content.Replace($oldVersion, $version) 23 | } else { 24 | throw "Failed to find funcVersion entry in ""$filePath""" 25 | } 26 | 27 | # Update consolidatedBuildId 28 | if ($content -match 'consolidatedBuildId = "(.*)"') { 29 | $oldConsolidatedBuildId = $Matches.1 30 | $content = $content.Replace($oldConsolidatedBuildId, $consolidatedBuildId) 31 | } else { 32 | throw "Failed to find consolidatedBuildId entry in ""$filePath""" 33 | } 34 | 35 | # Update sha for each arch 36 | foreach($arch in "osx-x64", "osx-arm64", "linux-x64") { 37 | if ($content -match "funcArch = ""$arch""\s*funcSha = ""(.*)""") { 38 | $oldSha = $Matches.1 39 | $dropLocation = "$artifactsDirectoryRoot/_core-tools-consolidated-artifacts.official/drop-$arch/coretools-cli" 40 | $shaPath = Join-Path $dropLocation "Azure.Functions.Cli.$arch.$version.zip.sha2" 41 | $sha = Get-Content -Path $shaPath 42 | $content = $content.Replace($oldSha, $sha) 43 | } else { 44 | Write-Host "Skipping arch ""$arch"", not found in ""$filePath""" 45 | } 46 | } 47 | 48 | Set-Content -Path $filePath -Value $content -NoNewline 49 | Write-Host "Updated formula $filePath" 50 | } 51 | 52 | $majorVersion=([version]$version).Major 53 | 54 | updateFormula "@$majorVersion" 55 | 56 | # Also update files with legacy suffixes 57 | if($majorVersion -eq "2") 58 | { 59 | updateFormula "" 60 | } 61 | elseif($majorVersion -eq "3") 62 | { 63 | updateFormula "-v3-preview" 64 | } 65 | --------------------------------------------------------------------------------