Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into dependabot/npm_and_ya…
Browse files Browse the repository at this point in the history
…rn/src/vscode-bicep/axios-and-vscode-tas-client-1.6.2
  • Loading branch information
anthony-c-martin committed Jan 2, 2024
2 parents a8cc6d7 + 276cffe commit a5d9977
Show file tree
Hide file tree
Showing 187 changed files with 10,068 additions and 7,885 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ updates:
schedule:
interval: "weekly"
day: "sunday"
ignore:
- dependency-name: "Moq"
- package-ecosystem: "nuget"
directory: "/src/vs-bicep"
schedule:
interval: "weekly"
day: "sunday"
ignore:
- dependency-name: "Moq"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
working-directory: ./src/playground

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: ./src/playground/dist

Expand Down
126 changes: 70 additions & 56 deletions docs/installing-nightly.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,35 @@
# Installing the "Nightly" build of Bicep CLI and VS Code extension

>**Note**: only install the nightly if you'd like to try the bleeding edge capabilities of Bicep. These are much more likely to have undiscovered bugs or other issues. If you find anything, please open an issue.
> **Note**: only install the nightly if you'd like to try the bleeding edge capabilities of Bicep. These are much more likely to have undiscovered bugs or other issues. If you find anything, please open an issue.
## Automatic (Mac/Linux)
## Via Script
> **Note**: These scripts require the [GitHub CLI](https://cli.github.com/) to have already been installed.
### VSCode Extension
1. Run the following:
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh)
```
1. Reload your VSCode window.

### Azure CLI
1. Run the following:
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh)
```
1. Your Azure CLI install should now be referencing the latest nightly Bicep CLI release.
This will install the latest nightly release of the VSCode extension

### Targeting a particular build or branch
The following optional arguments are also supported in the nightly install scripts:
- Installing from a GitHub branch (VSCode extension):
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --branch jeskew/variable-imports
```
- Installing from a GitHub branch (CLI):
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --branch jeskew/variable-imports
```
- Installing from a GitHub Action run (VSCode extension):
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 6146657618
```
- Installing from a GitHub Action run (CLI):
1. (Mac/Linux) Run the following:
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 6146657618
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh)
```

## Automatic (Windows)

### VSCode Extension
1. Run the following in a PowerShell window:
1. (Windows) Run the following in a PowerShell window:
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) }"
```
1. Reload your VSCode window.
1. Reload your VSCode window and the nightly Bicep extension will be loaded.

### Azure CLI
1. Run the following in a PowerShell window:
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) }"
```
1. Reload your VSCode window.
This will install the latest nightly Bicep CLI binary to `~/.azure/bin/bicep`, so that it will be automatically picked up by Azure CLI

### Targeting a particular build or branch
The following optional arguments are also supported in the nightly install scripts:
- Installing from a GitHub branch (VSCode extension):
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -Branch jeskew/variable-imports"
```
- Installing from a GitHub branch (CLI):
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -Branch jeskew/variable-imports"
```
- Installing from a GitHub Action run (VSCode extension):
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 6146657618"
1. (Mac/Linux) Run the following:
```sh
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh)
```
- Installing from a GitHub Action run (CLI):
1. (Windows) Run the following in a PowerShell window:
```powershell
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 6146657618"
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) }"
```
1. Your Azure CLI install should now be referencing the latest nightly Bicep CLI release.

## Manual
We are not currently publishing "nightly" releases, but you can grab the latest bits by viewing the latest Action workflows for the `main` branch (or any other branch).
Expand All @@ -89,3 +48,58 @@ The VSCode extension (`vscode-bicep.vsix`) must be unzipped and then can be inst
- Click "Install".

The CLI (`bicep-release-*-x64`) should replace any current Bicep executable that has already been added to your PATH. If you are on Windows and previously installed using the installer (`bicep-setup-win-x64`), then downloading and running the new installer will replace the currently installed version of Bicep.

## Advanced Script Options
### VSCode Extension
- Mac/Linux
```sh
# install from a fork repo
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --repo anthony-c-martin/bicep

# install from a custom branch
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --branch jeskew/variable-imports

# install from a specific github action run
bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 6146657618
```
- Windows
```powershell
# install from a fork repo
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -Repo anthony-c-martin/bicep"
# install from a custom branch
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -Branch jeskew/variable-imports"
# install from a specific github action run
iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 6146657618"
```

### Bicep CLI
- Mac/Linux
```sh
# install to a custom directory
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --binary-path /usr/local/bin

# install from a fork repo
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --repo anthony-c-martin/bicep

# install from a custom branch
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --branch jeskew/variable-imports

# install from a specific github action run
bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 6146657618
```
- Windows
```powershell
# install to a custom directory
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -BinaryPath C:\"
# install from a fork repo
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -Repo anthony-c-martin/bicep"
# install from a custom branch
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -Branch jeskew/variable-imports"
# install from a specific github action run
iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 6146657618"
```
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "3.7.0"
"Microsoft.Build.NoTargets": "3.7.56"
},
"sdk": {
"allowPrerelease": false,
"version": "7.0.100",
"rollForward": "latestFeature"
}
}
}
23 changes: 15 additions & 8 deletions scripts/install_cli_nightly.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[cmdletbinding()]
param(
[string]$RunId,
[string]$Branch
[string]$Branch,
[string]$Repo,
[string]$BinaryPath
)

$ErrorActionPreference="Stop"
Expand All @@ -25,25 +27,30 @@ switch ($platform) {
}

# Fetch
$repo = "Azure/bicep"
if (!$BinaryPath) {
# Default to ~/.azure/bin
$BinaryPath = [System.IO.Path]::combine($HOME, ".azure", "bin")
}
if (!$Repo) {
$Repo = "Azure/bicep"
}
if (!$Branch) {
$Branch = "main"
}
if (!$RunId) {
$RunId = & gh run list -R $repo --branch $Branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId"; if(!$?) { throw }
$RunId = & gh run list -R $Repo --branch $Branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId"; if(!$?) { throw }
}
$tmpDir = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())
& gh run download -R $repo $RunId -n "bicep-release-$platform-$arch" --dir $tmpDir; if(!$?) { throw }
& gh run download -R $Repo $RunId -n "bicep-release-$platform-$arch" --dir $tmpDir; if(!$?) { throw }

# Install
$azCliBinDir = [System.IO.Path]::combine($HOME, ".azure", "bin")
$bicepPath = [System.IO.Path]::combine($azCliBinDir, "bicep.exe")
New-Item -ItemType Directory -Force -Path $azCliBinDir | Out-Null
$bicepPath = [System.IO.Path]::combine($BinaryPath, "bicep.exe")
New-Item -ItemType Directory -Force -Path $BinaryPath | Out-Null
Move-Item -Path "$tmpDir/bicep.exe" -Destination $bicepPath -Force

$versionStdout = & $bicepPath --version; if(!$?) { throw }
$version = $versionStdout -replace '^.* ([0-9]*\.[0-9]*\.[0-9]*) .*$', '$1'
echo "Installed Bicep $version from https://github.com/Azure/bicep/actions/runs/$RunId to $bicepPath"
echo "Installed Bicep $version from https://github.com/$Repo/actions/runs/$RunId to $bicepPath"

# Cleanup
Remove-Item $tmpDir -Recurse
31 changes: 19 additions & 12 deletions scripts/install_cli_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ set -e

while [ $# -gt 0 ]; do
case "$1" in
--run-id) runId="${2}"; shift;;
--branch) branch="${2}"; shift;;
*) echo "Unrecognized argument \"${1}\"."; exit 1;;
--run-id) runId="${2}"; shift;;
--branch) branch="${2}"; shift;;
--repo) repo="${2}"; shift;;
--binary-path) binaryPath="${2}"; shift;;
*) echo "Unrecognized argument \"${1}\"."; exit 1;;
esac
shift
done
Expand All @@ -28,29 +30,34 @@ case "$(uname -m)" in
esac

# Fetch
REPO="Azure/bicep"
if [ -z "$binaryPath" ]; then
# Default to ~/.azure/bin
binaryPath="$HOME/.azure/bin"
fi
if [ -z "$repo" ]; then
repo="Azure/bicep"
fi
if [ -z "$branch" ]; then
branch=main
fi
if [ -z "$runId" ]; then
runId=$(gh run list -R $REPO --branch $branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId")
runId=$(gh run list -R $repo --branch $branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId")
fi
tmpDir=$(mktemp -d)
gh run download -R $REPO $runId -n "bicep-release-$platform-$arch" --dir $tmpDir
gh run download -R $repo $runId -n "bicep-release-$platform-$arch" --dir $tmpDir

# Install
if [[ $platform == "osx" ]]; then
# Ad-hoc sign the binary
codesign -s - "$tmpDir/bicep"
fi

AZCLI_BIN_DIR="$HOME/.azure/bin"
mkdir -p $AZCLI_BIN_DIR
mv "$tmpDir/bicep" "$AZCLI_BIN_DIR/bicep"
chmod +x "$AZCLI_BIN_DIR/bicep"
mkdir -p $binaryPath
mv "$tmpDir/bicep" "$binaryPath/bicep"
chmod +x "$binaryPath/bicep"

version=$("$AZCLI_BIN_DIR/bicep" --version | sed 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\) .*/\1/')
echo "Installed Bicep $version from https://github.com/Azure/bicep/actions/runs/$runId to $AZCLI_BIN_DIR/bicep"
version=$("$binaryPath/bicep" --version | sed 's/^.* \([0-9]*\.[0-9]*\.[0-9]*\) .*/\1/')
echo "Installed Bicep $version from https://github.com/$repo/actions/runs/$runId to $binaryPath/bicep"

# Cleanup
rm -Rf $tmpDir
13 changes: 8 additions & 5 deletions scripts/install_vsix_nightly.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[cmdletbinding()]
param(
[string]$RunId,
[string]$Branch
[string]$Branch,
[string]$Repo
)

$ErrorActionPreference="Stop"
Expand All @@ -11,20 +12,22 @@ if ((Get-Command "gh" -ErrorAction SilentlyContinue) -eq $null) {
}

# Fetch
$repo = "Azure/bicep"
if (!$Repo) {
$Repo = "Azure/bicep"
}
if (!$Branch) {
$Branch = "main"
}
if (!$RunId) {
$RunId = & gh run list -R $repo --branch $Branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId"; if(!$?) { throw }
$RunId = & gh run list -R $Repo --branch $Branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId"; if(!$?) { throw }
}
$tmpDir = [System.IO.Path]::combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())
& gh run download -R $repo $RunId -n "vscode-bicep.vsix" --dir $tmpDir; if(!$?) { throw }
& gh run download -R $Repo $RunId -n "vscode-bicep.vsix" --dir $tmpDir; if(!$?) { throw }

# Install
& code --install-extension "$tmpDir/vscode-bicep.vsix" --force; if(!$?) { throw }

echo "Installed Bicep VSCode extension from https://github.com/Azure/bicep/actions/runs/$RunId"
echo "Installed Bicep VSCode extension from https://github.com/$Repo/actions/runs/$RunId"

# Cleanup
Remove-Item $tmpDir -Recurse
17 changes: 10 additions & 7 deletions scripts/install_vsix_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ set -e

while [ $# -gt 0 ]; do
case "$1" in
--run-id) runId="${2}"; shift;;
--branch) branch="${2}"; shift;;
*) echo "Unrecognized argument \"${1}\"."; exit 1;;
--run-id) runId="${2}"; shift;;
--branch) branch="${2}"; shift;;
--repo) repo="${2}"; shift;;
*) echo "Unrecognized argument \"${1}\"."; exit 1;;
esac
shift
done
Expand All @@ -15,20 +16,22 @@ if ! command -v gh > /dev/null; then
fi

# Fetch
REPO="Azure/bicep"
if [ -z "$repo" ]; then
repo="Azure/bicep"
fi
if [ -z "$branch" ]; then
branch=main
fi
if [ -z "$runId" ]; then
runId=$(gh run list -R $REPO --branch $branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId")
runId=$(gh run list -R $repo --branch $branch --workflow build --status success -L 1 --json databaseId -q ".[0].databaseId")
fi
tmpDir=$(mktemp -d)
gh run download -R $REPO $runId -n "vscode-bicep.vsix" --dir $tmpDir
gh run download -R $repo $runId -n "vscode-bicep.vsix" --dir $tmpDir

# Install
code --install-extension "$tmpDir/vscode-bicep.vsix" --force

echo "Installed Bicep VSCode extension from https://github.com/Azure/bicep/actions/runs/$runId"
echo "Installed Bicep VSCode extension from https://github.com/$repo/actions/runs/$runId"

# Cleanup
rm -Rf $tmpDir

0 comments on commit a5d9977

Please sign in to comment.