-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
9,220 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: azureDevOps-ext-ci | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "ext/azuredevops/**" | ||
- ".github/workflows/devops-ext-ci.yml" | ||
branches: [main] | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "18" | ||
- name: Install dependencies | ||
run: | | ||
npm install -g npm | ||
npm install | ||
working-directory: ./ext/azuredevops/setupAzd | ||
|
||
- name: Test | ||
run: npm test | ||
working-directory: ./ext/azuredevops/setupAzd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
vsix | ||
tsbuildinfo | ||
codepaths | ||
azuretools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Contributing guide | ||
|
||
## Prerequisites | ||
|
||
Learn about [Azure devops custom tasks](https://learn.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops). | ||
|
||
## Submitting A Change | ||
|
||
We use a fork based workflow. Here are simple steps: | ||
|
||
1. Fork `azure/azure-dev` on GitHub. | ||
2. Create a branch named `<some-description>` (e.g. `fix-123` for a bug fix or `add-deploy-command`) in your forked Git | ||
repository. | ||
3. Push the branch to your fork on GitHub. | ||
4. Open a pull request in GitHub. | ||
|
||
Here is a more [in-depth guide to forks in GitHub](https://guides.github.com/activities/forking/). | ||
|
||
As part of CI validation, we run a series of live tests which provision and deprovision Azure resources. For external | ||
contributors, these tests will not run automatically, but someone on the team will be able to run them for your PR on your | ||
behalf. | ||
|
||
## Build | ||
|
||
- From `setupAzd` folder: | ||
- Run `npm install` | ||
- Run `tsc` | ||
- Run `tfx extension create --manifest-globs vss-extension.json` to create the extension. | ||
|
||
## Testing | ||
|
||
From `setupAzd` folder, run `npm test` | ||
|
||
## Release | ||
|
||
- Update `setupAzd/task.json` with the `version` number. | ||
- Update `vss-extension.json` with the `version` to release. | ||
- Run the `build` steps to produce the `vsix` release artifact. | ||
- Follow [publish steps](https://learn.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops#5-publish-your-extension) to update the Marketplace. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Azure DevOps Task for installing the Azure Developer CLI (`azd`) | ||
|
||
This Azure DevOps task allows you to provision resources and deploy your application on Azure with [Azure Developer CLI](https://github.com/azure/setup-azd) commands. | ||
|
||
The task installs the Azure Developer CLI on a user-defined Azure Developer CLI version. If the user does not specify a version, latest CLI version is used. Read more about various Azure Developer CLI versions [here](https://github.com/Azure/azure-dev/releases). | ||
|
||
- `version` – **Optional** Example: 1.0.1, Default: set to latest azd cli version. | ||
|
||
## Sample pipeline install latest `azd` version | ||
|
||
```yaml | ||
trigger: | ||
- main | ||
- branch | ||
|
||
pool: | ||
vmImage: ubuntu-latest | ||
# vmImage: windows-latest | ||
|
||
steps: | ||
- task: setup-azd@0 | ||
displayName: Install azd | ||
``` | ||
## Sample pipeline install a specific `azd` version | ||
|
||
Select a specific `azd` version [here](https://github.com/Azure/azure-dev/releases) and use it in `version`. | ||
|
||
```yaml | ||
trigger: | ||
- main | ||
- branch | ||
pool: | ||
vmImage: ubuntu-latest | ||
# vmImage: windows-latest | ||
steps: | ||
- task: setup-azd@0 | ||
inputs: | ||
version: '1.0.2' | ||
displayName: Install azd | ||
``` | ||
|
||
## Getting help for Azure Developer CLI issues | ||
|
||
If you encounter an issue related to the Azure Developer CLI commands executed in your script, you can file an issue directly on the [Azure Developer CLI repository](https://github.com/Azure/azure-dev/issues/new/choose). | ||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. | ||
|
||
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
index.js | ||
node_modules | ||
.taskkey | ||
index.js | ||
tests/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"args": [ | ||
"-u", | ||
"tdd", | ||
"--timeout", | ||
"999999", | ||
"--colors", | ||
"${workspaceFolder}/tests" | ||
], | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"name": "Mocha Tests", | ||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", | ||
"request": "launch", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "node" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"program": "${workspaceFolder}/tests/_suite.js", | ||
"outFiles": [ | ||
"${workspaceFolder}/**/*.js" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
NOTICES AND INFORMATION | ||
Do Not Translate or Localize | ||
|
||
This software incorporates material from third parties. | ||
Microsoft makes certain open source code available at https://3rdpartysource.microsoft.com, | ||
or you may send a check or money order for US $5.00, including the product name, | ||
the open source component name, platform, and version number, to: | ||
|
||
Source Code Compliance Team | ||
Microsoft Corporation | ||
One Microsoft Way | ||
Redmond, WA 98052 | ||
USA | ||
|
||
Notwithstanding any other terms, you may reverse engineer this software to the extent | ||
required to debug changes to any libraries licensed under the GNU Lesser General Public License. | ||
|
||
--------------------------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import * as task from 'azure-pipelines-task-lib/task'; | ||
import * as cp from 'child_process' | ||
import path from 'path'; | ||
import * as fs from 'fs' | ||
import download from 'download'; | ||
import decompress from 'decompress'; | ||
|
||
export async function runMain(): Promise<void> { | ||
try { | ||
task.setTaskVariable('hasRunMain', 'true'); | ||
const version = task.getInput('version') || 'latest' | ||
|
||
console.log("using version: " + version) | ||
|
||
// get architecture and os | ||
const architecture = process.arch | ||
const os = process.platform | ||
|
||
// map for different platform and arch | ||
const extensionMap = { | ||
linux: '.tar.gz', | ||
darwin: '.zip', | ||
win32: '.zip' | ||
} | ||
|
||
const exeMap = { | ||
linux: '', | ||
darwin: '', | ||
win32: '.exe' | ||
} | ||
|
||
const arm64Map = { | ||
x64: 'amd64', | ||
arm64: 'arm64-beta' | ||
} | ||
|
||
const platformMap = { | ||
linux: 'linux', | ||
darwin: 'darwin', | ||
win32: 'windows' | ||
} | ||
|
||
// get install url | ||
const installArray = installUrlForOS( | ||
os, | ||
architecture, | ||
platformMap, | ||
arm64Map, | ||
extensionMap, | ||
exeMap | ||
) | ||
|
||
const url = `https://azure-dev.azureedge.net/azd/standalone/release/${version}/${installArray[0]}` | ||
|
||
console.log(`The Azure Developer CLI collects usage data and sends that usage data to Microsoft in order to help us improve your experience. | ||
You can opt-out of telemetry by setting the AZURE_DEV_COLLECT_TELEMETRY environment variable to 'no' in the shell you use. | ||
Read more about Azure Developer CLI telemetry: https://github.com/Azure/azure-dev#data-collection`) | ||
|
||
console.log(`Installing azd from ${url}`) | ||
const buffer = await download(url); | ||
const extractedTo = path.join(task.cwd(), 'azd-install'); | ||
await decompress(buffer, extractedTo); | ||
|
||
let binName | ||
if (os !== 'win32') { | ||
binName = 'azd'; | ||
} else { | ||
binName = 'azd.exe'; | ||
} | ||
const binPath = path.join(extractedTo, binName); | ||
|
||
fs.symlinkSync( | ||
path.join(extractedTo, installArray[1]), | ||
binPath | ||
) | ||
task.prependPath(extractedTo) | ||
console.log(`azd installed to ${extractedTo}`) | ||
|
||
task.exec(binPath, 'version') | ||
} catch (err: any) { | ||
task.setResult(task.TaskResult.Failed, err.message); | ||
} | ||
} | ||
|
||
function installUrlForOS( | ||
os: string, | ||
architecture: string, | ||
platformMap: Record<string, string>, | ||
archMap: Record<string, string>, | ||
extensionMap: Record<string, string>, | ||
exeMap: Record<string, string> | ||
): [string, string] { | ||
const platformPart = `${platformMap[os]}` | ||
const archPart = `${archMap[architecture]}` | ||
|
||
if (platformPart === `undefined` || archPart === `undefined`) { | ||
throw new Error( | ||
`Unsupported platform and architecture: ${architecture} ${os}` | ||
) | ||
} | ||
|
||
const installUrl = `azd-${platformPart}-${archPart}${extensionMap[os]}` | ||
const installUrlForRename = `azd-${platformPart}-${archPart}${exeMap[os]}` | ||
|
||
return [installUrl, installUrlForRename] | ||
} | ||
|
||
runMain(); |
Oops, something went wrong.