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

Passing ENV variable to goss plugin #82

Open
tuxtof opened this issue Jan 26, 2024 · 4 comments · May be fixed by #101
Open

Passing ENV variable to goss plugin #82

tuxtof opened this issue Jan 26, 2024 · 4 comments · May be fixed by #101

Comments

@tuxtof
Copy link
Contributor

tuxtof commented Jan 26, 2024

is there a way to set env variable in the context where the goss binary is downloaded ?
I want to set proxy env variable to let curl || wget to connect on internet

@btassone
Copy link
Contributor

btassone commented Feb 7, 2024

is there a way to set env variable in the context where the goss binary is downloaded ? I want to set proxy env variable to let curl || wget to connect on internet

Are you talking about creating an environment variable for the base part of url in the getDownloadUrl method here:

return fmt.Sprintf("https://github.com/goss-org/goss/releases/download/v%s/%s", p.config.Version, filename)
?

@tuxtof
Copy link
Contributor Author

tuxtof commented Feb 7, 2024

no i'm talking about specifying env variable used by the wget/curl command who download the goss binary to change their behaviour, in this specific case use a proxy

@FalcoSuessgott
Copy link
Collaborator

I think the plugin does provide that ability using VarsEnv var:

func (p *Provisioner) envVars() string {
var sb strings.Builder
for env_var, value := range p.config.VarsEnv {
switch p.config.TargetOs {
case windows:
// Windows requires a call to "set" as separate command seperated by && for each env variable
sb.WriteString(fmt.Sprintf("set \"%s=%s\" && ", env_var, value))
default:
sb.WriteString(fmt.Sprintf("%s=\"%s\" ", env_var, value))
}
}
return sb.String()
}
func (p *Provisioner) sslFlag(cmdType string) string {
if p.config.SkipSSLChk {
switch cmdType {
case "curl":

In case I find some time I could try to provide you an example ..

@pli01
Copy link

pli01 commented May 5, 2024

Hello,

I have the same question and problem:

  • my remote instance running goss and the installGoss function, is behind a corporate proxy and can't "curl||wget" directly the goss package from github.

Do you know, if there is a way to override/set http_proxy,https_proxy,no_proxy variable in installGoss part, around this function Packer.RemoteCmdrunning curl/wget ?

https://github.com/YaleUniversity/packer-plugin-goss/blob/master/provisioner/goss/packer-provisioner-goss.go#L333

envVar function does not work at this step.

Thank you for you help

@FalcoSuessgott FalcoSuessgott linked a pull request Jul 10, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants