generated from hashicorp/packer-plugin-scaffolding
-
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
SDK Migration - V2 Beta #306
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e141427
Rebasing entire ARM builder migration on top of main
JenGoldstrich fed4710
Remove some missed old SDK stuff, including the autorest To package f…
JenGoldstrich 52b86d7
Update oidc-example.json
JenGoldstrich 337b9d9
Pass SIG ID subscription through to state
JenGoldstrich 2161a3d
Use Hamilton MSGraph SDK to fetch Object ID for Windows builds
JenGoldstrich 841570a
Format and add comment
JenGoldstrich 64b5a43
commit generated code
JenGoldstrich 04a4a81
Switch AuthType back to private variable and use helper function to g…
JenGoldstrich a6971a6
Print MSgraph error again
JenGoldstrich 09e6211
Don't use Hamilton, get it from the Access Token
JenGoldstrich fdc53ce
fmt and pass in correct context on cleanup
JenGoldstrich 083f230
Mess with backoff time while testing to see if this can be a bit smoo…
JenGoldstrich 1cd9b80
Don't use context.TODOs in ARM Builder client calls
JenGoldstrich b8c600a
Update with newest cty fork
JenGoldstrich 994b7f4
Use hcl file in oidc test
JenGoldstrich a37cd44
Use Giovanni instead of Blob Container serivce
JenGoldstrich ffd128b
Implement new SDK environment logic
JenGoldstrich 2f80201
Address fmt
JenGoldstrich 015fabd
Remove unused function, go mod tidy
JenGoldstrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
# taken and modified from https://github.com/hashicorp/go-azure-sdk/blob/main/.github/workflows/pr-acceptance-tests.yml | ||
name: OIDC Example - Testing OIDC integration in the SDK branch | ||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
secrets-check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
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 | ||
- id: check-secrets | ||
run: | | ||
if [[ "${ACTIONS_ID_TOKEN_REQUEST_URL}" == "" ]]; then | ||
echo "available=false" | tee ${GITHUB_OUTPUT} | ||
else | ||
echo "available=true" | tee ${GITHUB_OUTPUT} | ||
fi | ||
|
||
test-oidc: | ||
runs-on: ubuntu-latest | ||
needs: [secrets-check] | ||
if: needs.secrets-check.outputs.available == 'true' | ||
steps: | ||
- name: Set OIDC Token | ||
run: | | ||
echo "ARM_OIDC_TOKEN=$(curl -H "Accept: application/json; api-version=2.0" -H "Authorization: Bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" -H "Content-Type: application/json" -G --data-urlencode "audience=api://AzureADTokenExchange" "${ACTIONS_ID_TOKEN_REQUEST_URL}" | jq -r '.value')" >>${GITHUB_ENV} | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0 | ||
with: | ||
go-version: '1.19.5' | ||
|
||
- name: Checkout | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- name: Setup `packer` | ||
uses: hashicorp/setup-packer@main | ||
id: setup | ||
|
||
- name: Build the plugin | ||
run: make | ||
|
||
- name: Try to run an AzureARM build with our OIDC token | ||
run: packer build -force ./example/oidc-example.pkr.hcl | ||
env: | ||
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID}} | ||
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID}} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 very ignorant of this plugin, but what's a SAS URL, and why do we remove that here? I presume this is not necessary anymore?
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.
Related but not too much, I see the only other place where there's a reference to a
getSasUrl
is in theNewArtifact
function for thedtl
builder (inbuilder/azure/dtl/artifact.go
line 56), which is never used in the code according togopls
, so I presume we could remove this as well?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.
Good question, a SAS URL is a link to an Azure Storage account resource with an embedded token, we create SAS tokens in VHD builds and when using managed image builds without deleting the disk I believe, however we've been asked by a lot of our users to remove this here #250, because of the security concerns of using these they are not recommended by Microsoft, we are doing them in every build. To top it off the new SDK does not provide the same helper we currently use to generate these tokens.
So for v2 after chatting with Wilken, and given the above issue, I am proposing removing them, they can still be created by users outside of Packer, and this was never used in the resulting Azure Artifact, but was simply printed in the terminal output of the build.
Yes we should remove it from the DTL builder but I would like to hold of any changes to the DTL builder until we have signed off on the way we've handling this for the ARM builder