-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to the newest version of hashicorp/go-azure-sdk #396
Conversation
cfe7219
to
5e0089e
Compare
@@ -50,12 +45,18 @@ type AzureClientSet interface { | |||
var _ AzureClientSet = &azureClientSet{} | |||
|
|||
type azureClientSet struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this client is in the common package it is only used by the chroot builder, the way I made this work with the new clients is a bit hacky, but I felt it wasn't worth a lot of time refactoring the chroot builder heavily as it makes up a very small percent of our usage.
ea49404
to
4e24ebf
Compare
@@ -1,40 +1,36 @@ | |||
module github.com/hashicorp/packer-plugin-azure | |||
|
|||
go 1.19 | |||
go 1.21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packer-plugin-azure/.go-version
Line 1 in 36cc195
1.21.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 1.21.8 a requirement for these changes or should we just always set to 1.21.N since this is technically the latest version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at all, I just bumped us to 1.21 based on what was already set in the .go-version, these changes should work independent of go minor version.
06081ef
to
47c605c
Compare
GNUmakefile
Outdated
dev: build | ||
@mkdir -p ~/.packer.d/plugins/ | ||
@mv ${BINARY} ~/.packer.d/plugins/${BINARY} | ||
dev: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this is showing up as a change, when I checkout the makefile from main I don't see any changes either 🤔
➜ packer-plugin-azure git:(bump_go_azure_sdk) git checkout origin/main -- GNUmakefile
➜ packer-plugin-azure git:(bump_go_azure_sdk) gst
On branch bump_go_azure_sdk
nothing to commit, working tree clean
…ug, move metadata client off auto-rest, and handle unathenticated subscription call in custom http client
7d494b0
to
21eb7b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I appreciate the added context for the context.WithTimeout.
This PR makes several changes to upgrade
github.com/hashicorp/go-azure-sdk
from versionv0.20230523.1140858
to the newest version at the time of this PRv0.20240327.1161949
, and to fully remove the deprecated Microsoftgo-autorest
library.Every request on the new SDK client layer requires a context with a deadline, otherwise requests fail with the following error
the context used must have a deadline attached for polling purposes, but got no deadline
, even if counter-intuitively the request would not use pollingWhen the tenant ID is unset and not using CLI auth the plugin makes an unauthenticated HTTP request to the GetSubscriptions endpoint to fetch the tenant ID through the auth headers, the new SDK does not return these headers unless the auth object is correctly configured so now this is done with a regular http client
The Chroot Builder used an autorest client to connect to the Azure IMDS, this has also been modified to use a regular http client, enabling the removal of auto rest
The chroot builder has a long running bug Azure-chroot has issues with detecting environment information. Error is 'function "vm" not defined' #87 where we get an error that the
vm
template function is not defined unless setting 4 temporary values, this is due to an issue with the packer SDK wiping out this function when calling Decode, @lbajolet-hashicorp is investigating this issue further on the SDK end but to fix this on chroot this PR moves the function after Decode, so that is available in the builder. Thevm
function does not appear to be working at all currently, but this seems due to the SDK bug, and will be addressed in a follow up PR if not.Closes #87
Unblocks #395