Skip to content

Commit

Permalink
fix winget install
Browse files Browse the repository at this point in the history
  • Loading branch information
colbylwilliams committed Oct 18, 2022
1 parent 45a2538 commit 69b9e8b
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 36 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Microsoft Azure CLI Custom Image Helper 'az' Extension adds useful "utilities" f
To install the Azure CLI Custom Image Helper extension, simply run the following command:

```sh
az extension add --source https://github.com/colbylwilliams/az-bake/releases/latest/download/bake-0.0.22-py3-none-any.whl -y
az extension add --source https://github.com/colbylwilliams/az-bake/releases/latest/download/bake-0.0.23-py3-none-any.whl -y
```

### Update
Expand All @@ -29,22 +29,22 @@ az bake upgrade --pre
This extension adds the following commands. Use `az bake -h` for more information.
| Command | Description |
| ------- | ----------- |
| [az bake user check](#az-bake-user-check) | Check if a user has appropriate licenses to use dev box. |
| [az bake repo](#az-bake-repo) | // TODO |

---

### `az bake user check`
### `az bake repo`

Check if a user has appropriate licenses to use dev box.
// TODO

```sh
az bake user check --user
az bake repo
```

#### Examples

```sh
az bake user check --user user@example.com
az bake repo

# output: user@example.com has valid licenses for dev box: ['SPE_E3']
```
Expand Down
4 changes: 4 additions & 0 deletions bake/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

0.0.23
++++++
+ Fix winget install

0.0.22
++++++
+ Add new schema files
Expand Down
18 changes: 7 additions & 11 deletions bake/azext_bake/_packer.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,13 @@ def inject_winget_provisioners(image_dir, winget_packages):
# Injected by az bake
provisioner "powershell" {{
inline = [
"$file=Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle",
"$path=$env:TEMP/$file",
"Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/latest/download/$file -OutFile $path",
"Add-AppxPackage -InstallAllResources -ForceTargetApplicationShutdown -ForceUpdateFromAnyVersion -Path $path",
"Add-AppxProvisionedPackage -Online -SkipLicense -PackagePath $path",
"$file=source.msix",
"$path=$env:TEMP/$file",
"Invoke-WebRequest -Uri https://winget.azureedge.net/cache/$file -OutFile $path",
"Add-AppxPackage -ForceTargetApplicationShutdown -ForceUpdateFromAnyVersion -Path $path",
"Add-AppxProvisionedPackage -Online -SkipLicense -PackagePath $path",
"(new-object net.webclient).DownloadFile('https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle', 'C:/Windows/Temp/appinstaller.msixbundle')",
"Add-AppxPackage -InstallAllResources -ForceTargetApplicationShutdown -ForceUpdateFromAnyVersion -Path 'C:/Windows/Temp/appinstaller.msixbundle'",
"Add-AppxProvisionedPackage -Online -SkipLicense -PackagePath 'C:/Windows/Temp/appinstaller.msixbundle'",
"(new-object net.webclient).DownloadFile('https://winget.azureedge.net/cache/source.msix', 'C:/Windows/Temp/source.msix')",
"Add-AppxPackage -ForceTargetApplicationShutdown -ForceUpdateFromAnyVersion -Path 'C:/Windows/Temp/source.msix'",
"Add-AppxProvisionedPackage -Online -SkipLicense -PackagePath 'C:/Windows/Temp/source.msix'",
"winget source reset --force",
"winget source list"
Expand Down
3 changes: 1 addition & 2 deletions bake/azext_bake/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def bake_builder_build(cmd, in_builder=False, repo=None, storage=None, sandbox=N

save_packer_vars_file(sandbox, gallery, image)

success = packer_execute(image)
# success = True
success = packer_execute(image) if in_builder else True

if not success:
raise CLIError('Packer build failed')
Expand Down
22 changes: 11 additions & 11 deletions bake/azext_bake/templates/packer/build.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
packer {
required_plugins {
# https://github.com/rgl/packer-plugin-windows-update
windows-update = {
version = "0.14.1"
source = "github.com/rgl/windows-update"
}
}
}
// packer {
// required_plugins {
// # https://github.com/rgl/packer-plugin-windows-update
// windows-update = {
// version = "0.14.1"
// source = "github.com/rgl/windows-update"
// }
// }
// }

# https://www.packer.io/plugins/builders/azure/arm
source "azure-arm" "vm" {
Expand Down Expand Up @@ -79,8 +79,8 @@ build {
}

# https://github.com/rgl/packer-plugin-windows-update
provisioner "windows-update" {
}
// provisioner "windows-update" {
// }
###BAKE###

# Disable Auto-Logon that was enabled above
Expand Down
2 changes: 1 addition & 1 deletion bake/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")

# Must match a HISTORY.rst entry.
VERSION = '0.0.22'
VERSION = '0.0.23'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
2 changes: 1 addition & 1 deletion builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ LABEL maintainer="Microsoft" \
RUN apk add --no-cache packer --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community

# install az-bake
RUN az extension add --source https://github.com/colbylwilliams/az-bake/releases/latest/download/bake-0.0.22-py3-none-any.whl -y
RUN az extension add --source https://github.com/colbylwilliams/az-bake/releases/latest/download/bake-0.0.23-py3-none-any.whl -y

# Terminate container on stop
STOPSIGNAL SIGTERM
Expand Down
1 change: 0 additions & 1 deletion schema/bake.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"description": "Sandbox configuration",
"additionalProperties": false,
"required": [
"location",
"resourceGroup",
"subscription",
"virtualNetwork",
Expand Down
3 changes: 0 additions & 3 deletions schema/image.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
"type": "object",
"additionalProperties": false,
"required": [
"name",
"publisher",
"offer",
"sku",
"version",
"os"
Expand Down

0 comments on commit 69b9e8b

Please sign in to comment.