-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Adding linux VM support for packer build task #3754
Conversation
@bishalpd, |
}, | ||
{ | ||
"type": "shell", | ||
"execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'", |
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.
What does this mean?
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 means run the inline commands using sudo. packer creates a temp file containing all the inline commands and then executes it. Since, we are running user's deployment script, it is better to use sudo, otherwise script might fail.
"inline": [ | ||
"rm -rf /deployTemp", | ||
"mkdir /deployTemp", | ||
"chmod 777 /deployTemp" |
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.
Why are we setting mod here? Will it continue to apply after copying more files into this folder below. Otherwise should we do it before script execution. And why 777 and not +x or 700
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.
setting mod here since the next step which is file upload will need this. Packer does not provide a way to tell file upload to be done with sudo(unlike shell provisioner). I had tried with 700, but did not work.
@@ -0,0 +1,76 @@ | |||
{ |
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.
Any UTs?
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 am adding UTs in parallel. Will update the PR.
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.
updated UTs. please check.
Also tested that this task run properly on linux agent