Skip to content
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

docs:add command to delete packer cache and merge the .packerenv and … #1791

Merged
merged 12 commits into from
Nov 15, 2023

Conversation

lennessyy
Copy link
Contributor

@lennessyy lennessyy commented Nov 10, 2023

Describe the Change

This PR adds the command to delete packer cache before the user builds and uploads their VM templates.

Review Changes

πŸ’» Add Preview URL

🎫 Jira Ticket

Copy link

netlify bot commented Nov 10, 2023

βœ… Deploy Preview for docs-spectrocloud ready!

Name Link
πŸ”¨ Latest commit fb79d92
πŸ” Latest deploy log https://app.netlify.com/sites/docs-spectrocloud/deploys/655296161d9d400008836e22
😎 Deploy Preview https://deploy-preview-1791--docs-spectrocloud.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lennessyy
Copy link
Contributor Author

lennessyy commented Nov 11, 2023

I keep getting this error:

docker run --interactive --tty --rm \
  --env-file .packerenv \
  --env-file .goenv \
  --volume "${ISOFILEPATH}:/edge/vmware/packer/build" \
  ghcr.io/spectrocloud/tutorials:1.0.8 \
  sh -c "source /edge/vmware/clone_vm_template/setenv.sh && govc datastore.rm -ds=$vcenter_datastore /packer_cache && cd /edge/vmware/packer/ && packer build -force --var-file=vsphere.hcl build.pkr.hcl"
govc: default datastore resolves to multiple instances, please specify

If I go inside the docker container and run source /edge/vmware/clone_vm_template/setenv.sh && govc datastore.rm -ds=$vcenter_datastore /packer_cache && cd /edge/vmware/packer/ && packer build -force --var-file=vsphere.hcl build.pkr.hcl I do not get the same error and everything is fine.

Don't quite understand why this is happening. I tried googling this error and wasn't really able to find much about it that seems to apply to us. Do you have any ideas? @karl-cardenas-coding

@karl-cardenas-coding
Copy link
Contributor

Hmm....πŸ€” I wonder if the $ used in the -ds flag is resolving incorrectly

@lennessyy
Copy link
Contributor Author

lennessyy commented Nov 13, 2023

That does seem to be the case. I tried to have it echo the variable and it did not give me a response. I'll look into it more this week

@karl-cardenas-coding
Copy link
Contributor

Try wrapping the sh command in single to ticks, and use double quotes to escape the env variable.

sh -c 'source /edge/vmware/clone_vm_template/setenv.sh && echo "$vcenter_datastore"> /edge/vmware/packer/build/echo.txt'

@lennessyy lennessyy marked this pull request as ready for review November 13, 2023 19:02
@lennessyy lennessyy requested a review from a team as a code owner November 13, 2023 19:02
Copy link
Contributor

@karl-cardenas-coding karl-cardenas-coding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good @lennessyy just some minor suggestions . Let's make sure the tutorial image is released and available before we merge the PR.

@karl-cardenas-coding karl-cardenas-coding added auto-backport Enable backport backport-version-4-1 Backport change to version 4.1 labels Nov 13, 2023
Co-authored-by: Karl Cardenas <karl@spectrocloud.com>
@lennessyy lennessyy added 4.2 4.2 Release and removed 4.2 4.2 Release labels Nov 13, 2023
@lennessyy lennessyy enabled auto-merge (squash) November 15, 2023 21:29
@lennessyy lennessyy merged commit b04a9dd into master Nov 15, 2023
4 checks passed
@lennessyy lennessyy deleted the delete-packer-cache-vcenter branch November 15, 2023 21:42
vault-token-factory-spectrocloud bot pushed a commit that referenced this pull request Nov 15, 2023
#1791)

* docs:add command to delete packer cache and merge the .packerenv and .goenv file

* uncombine .goenv and .packerenv

* fix typo

* added command to source the setenv.sh first

* use absolute path

* docs: add command to delete packer cache

* add delete cache commands and explain the file additions

* fix typo

* Apply suggestions from code review

Co-authored-by: Karl Cardenas <karl@spectrocloud.com>

---------

Co-authored-by: Lenny Chen <lenny.chen@spectrocloud.com>
Co-authored-by: Karl Cardenas <karl@spectrocloud.com>
(cherry picked from commit b04a9dd)
@vault-token-factory-spectrocloud
Copy link
Contributor

πŸ’š All backports created successfully

Status Branch Result
βœ… version-4-1

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

lennessyy added a commit that referenced this pull request Nov 15, 2023
#1791) (#1815)

* docs:add command to delete packer cache and merge the .packerenv and .goenv file

* uncombine .goenv and .packerenv

* fix typo

* added command to source the setenv.sh first

* use absolute path

* docs: add command to delete packer cache

* add delete cache commands and explain the file additions

* fix typo

* Apply suggestions from code review

Co-authored-by: Karl Cardenas <karl@spectrocloud.com>

---------

Co-authored-by: Lenny Chen <lenny.chen@spectrocloud.com>
Co-authored-by: Karl Cardenas <karl@spectrocloud.com>
(cherry picked from commit b04a9dd)

Co-authored-by: Lenny Chen <55669665+lennessyy@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Enable backport backport-version-4-1 Backport change to version 4.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants