Skip to content

Commit

Permalink
Merge branch 'hashicorp:main' into fix/deprecated_ioutil
Browse files Browse the repository at this point in the history
  • Loading branch information
maxilampert authored Sep 30, 2023
2 parents 8e111ec + c472969 commit 9b8395f
Show file tree
Hide file tree
Showing 22 changed files with 2,473 additions and 227 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ensure-docs-compiled.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Ensure Docs are Compiled
on:
push:
jobs:
ensure-docs-compiled:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
- shell: bash
run: make build-docs
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make build-docs', and commit the result to resolve this error."
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/go-test-darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: Darwin Go tests
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: Linux Go tests
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
name: Windows Go tests
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
name: Go Mod Tidy
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: go mod tidy
Expand All @@ -46,7 +46,7 @@ jobs:
name: Lint check
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
Expand All @@ -60,7 +60,7 @@ jobs:
name: Gofmt check
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
Expand All @@ -78,7 +78,7 @@ jobs:
name: Generate check
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/notify-integration-release-via-manual.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Notify Integration Release (Manual)
on:
workflow_dispatch:
inputs:
version:
description: "The release version (semver)"
default: 0.0.1
required: false
branch:
description: "A branch or SHA"
default: 'main'
required: false
jobs:
notify-release:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ github.event.inputs.branch }}
# Ensure that Docs are Compiled
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- shell: bash
run: make build-docs
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make build-docs', and commit the result to resolve this error."
exit 1
fi
# Perform the Release
- name: Checkout integration-release-action
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: hashicorp/integration-release-action
path: ./integration-release-action
- name: Notify Release
uses: ./integration-release-action
with:
integration_identifier: "packer/hashicorp/azure"
release_version: ${{ github.event.inputs.version }}
release_sha: ${{ github.event.inputs.branch }}
github_token: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/notify-integration-release-via-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Notify Integration Release (Tag)
on:
push:
tags:
- '*.*.*' # Proper releases
- '*.*.*-*' # Pre releases
jobs:
notify-release:
runs-on: ubuntu-latest
steps:
- name: Checkout this repo
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
ref: ${{ github.ref }}
# Ensure that Docs are Compiled
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
- shell: bash
run: make build-docs
- shell: bash
run: |
if [[ -z "$(git status -s)" ]]; then
echo "OK"
else
echo "Docs have been updated, but the compiled docs have not been committed."
echo "Run 'make build-docs', and commit the result to resolve this error."
exit 1
fi
# Perform the Release
- name: Checkout integration-release-action
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
repository: hashicorp/integration-release-action
path: ./integration-release-action
- name: Notify Release
uses: ./integration-release-action
with:
integration_identifier: 'packer/hashicorp/azure'
release_version: ${{ github.ref_name }}
release_sha: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/oidc-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
secrets-check:
runs-on: ubuntu-latest
outputs:
available: "${{ steps.check-secrets.outputs.available }}"
available: ${{ steps.check-secrets.outputs.available }}
steps:
# we check for the ACTIONS_ID_TOKEN_REQUEST_URL variable as a proxy for other secrets
# it will be unset when running for a PR from a fork
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Describe plugin
Expand Down
102 changes: 102 additions & 0 deletions .web-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
The Azure plugin can be used with HashiCorp Packer to create custom images on Azure.
To do so, the plugin exposes multiple builders, among which you can choose the one most adapted to your workflow.

## Installation

To install this plugin, copy and paste this code into your Packer configuration, then run [`packer init`](https://www.packer.io/docs/commands/init).

```hcl
packer {
required_plugins {
azure = {
source = "github.com/hashicorp/azure"
version = "~> 2"
}
}
}
```

Alternatively, you can use `packer plugins install` to manage installation of this plugin.

```sh
$ packer plugins install github.com/hashicorp/azure
```

## Components

Packer can create Azure virtual machine images through variety of ways depending on the strategy that you want to use for building the images.

### Builders

- [azure-arm](/packer/integrations/hashicorp/azure/latest/components/builder/arm) - The Azure ARM builder supports building Virtual Hard Disks (VHDs) and
Managed Images in Azure Resource Manager.
- [azure-chroot](/packer/integrations/hashicorp/azure/latest/components/builder/chroot) - The Azure chroot builder supports building a managed disk image without
launching a new Azure VM for every build, but instead use an already-running Azure VM.
- [azure-dtl](/packer/integrations/hashicorp/azure/latest/components/builder/dtl) - The Azure DevTest Labs builder builds custom images and uploads them to DevTest Lab image repository automatically.

### Provisioners

- [azure-dtlartifact](/packer/integrations/hashicorp/azure/latest/components/provisioner/dtlartifact) - The Azure DevTest Labs provisioner can be used to apply an artifact to a VM - Refer to [Add an artifact to a VM](https://docs.microsoft.com/en-us/azure/devtest-labs/add-artifact-vm)

## Authentication

<!-- Code generated from the comments of the Config struct in builder/azure/common/client/config.go; DO NOT EDIT MANUALLY -->

Config allows for various ways to authenticate Azure clients. When
`client_id` and `subscription_id` are specified in addition to one and only
one of the following: `client_secret`, `client_jwt`, `client_cert_path` --
Packer will use the specified Azure Active Directory (AAD) Service Principal
(SP).
If none ofthese options are specified, Packer will attempt to use the Managed Identity
and subscription of the VM that Packer is running on. This will only work if
Packer is running on an Azure VM with either a System Assigned Managed
Identity or User Assigned Managed Identity.

<!-- End of code generated from the comments of the Config struct in builder/azure/common/client/config.go; -->


### Managed Identity

If you're running Packer on an Azure VM with a [managed
identity](https://packer.io/docs/builders/azure#azure-managed-identity) you
don't need to specify any additional configuration options. As Packer will
attempt to use the Managed Identity and subscription of the VM that Packer is
running on.

You can use a different subscription if you set `subscription_id`. If your VM
has multiple user assigned managed identities you will need to set `client_id`
too.

### Interactive User Authentication

To use interactive user authentication, you should specify
`use_interactive_auth` only. Packer will use cached credentials or redirect you
to a website to log in.

### Service Principal

To use a [service principal](https://packer.io/docs/builders/azure#azure-active-directory-service-principal)
you should specify `subscription_id`, `client_id` and one of `client_secret`,
`client_cert_path` or `client_jwt`.

- `subscription_id` (string) - Subscription under which the build will be
performed. **The service principal specified in `client_id` must have full
access to this subscription, unless build_resource_group_name option is
specified in which case it needs to have owner access to the existing
resource group specified in build_resource_group_name parameter.**

- `client_id` (string) - The Active Directory service principal associated with
your builder.

- `client_secret` (string) - The password or secret for your service principal.

- `client_cert_path` (string) - The location of a PEM file containing a
certificate and private key for service principal.

- `client_cert_token_timeout` (duration string | ex: "1h30m12s") - How long to set the expire time on the token created when using
`client_cert_path`.

- `client_jwt` (string) - The bearer JWT assertion signed using a certificate
associated with your service principal principal. See [Azure Active
Directory docs](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-certificate-credentials)
for more information.
Loading

0 comments on commit 9b8395f

Please sign in to comment.