Skip to content

Commit

Permalink
Fix env-vars for store deploy
Browse files Browse the repository at this point in the history
When deploying from the store, any --env variables passed or
defined for a function were being ignored due to a bug.

This has been fixed and tested.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Mar 13, 2023
1 parent 5c6e347 commit 2fd2848
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ func deployImage(
var statusCode int
readOnlyRFS := deployFlags.readOnlyRootFilesystem || readOnlyRootFilesystem
envvars, err := util.ParseMap(deployFlags.envvarOpts, "env")

if err != nil {
return statusCode, fmt.Errorf("error parsing envvars: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion commands/store_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func runStoreDeploy(cmd *cobra.Command, args []string) error {
envs := []string{}
for k, v := range mergedEnvs {
env := fmt.Sprintf("%s=%s", k, v)
storeDeployFlags.envvarOpts = append(envs, env)
envs = append(envs, env)
}

storeDeployFlags.envvarOpts = envs
Expand Down

5 comments on commit 2fd2848

@sebastianricaldoni
Copy link

Choose a reason for hiding this comment

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

Hi @alexellis and Openfaas team 🙌! Just wondering if this patch would fix an issue I'm having when using the docker flavor of faas-cli in my Github actions. A few days ago our CI/CD pipeline started failed until I read your post about docker hub and open source images. Basically what I did to fix it was replacing uses

      - name: Deploy the function
        uses: docker://openfaas/faas-cli:latest-root
        with:
          args: deploy -f service.yml --tag sha --gateway ${{ secrets.OPENFAAS_GATEWAY_STAGING }}
        env:
          DOCKER_USER: celled

to

      - name: Deploy the function
        uses: docker://ghcr.io/openfaas/faas-cli:latest-root
        with:
          args: deploy -f services-bulk-import-learners-api.yml --tag sha --gateway ${{ secrets.OPENFAAS_GATEWAY_PROD }}
        env:
          DOCKER_USER: celled

I understand that now I'm pulling faas-cli from Github's container registry rather than from Docker Hub. All good there 🙌
Now, what's happening is that after running faas-cli deploy I'm getting an error in my cluster because the deployment yaml is referencing an image with an incorrect tag name...

image

Any help would be much appreciated ...on top of all the appreciation we already have for supporting this amazing project!
Thanks!

@alexellis
Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @sebastianricaldoni the right place to ask questions is to raise an issue.

Can you go ahead and do that please?

Alex

@sebastianricaldoni
Copy link

Choose a reason for hiding this comment

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

Absolutely! I created #955 and sorry in advance if I missed anything. There's a high chance it isn't a bug on faas-cli but rather on my end.

Thanks!!

@alexellis
Copy link
Member Author

Choose a reason for hiding this comment

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

@sebastianricaldoni can you confirm that you've seen my response?

I've given you the answer there.

@sebastianricaldoni
Copy link

Choose a reason for hiding this comment

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

@sebastianricaldoni can you confirm that you've seen my response?

I've given you the answer there.

Yes I have! See here.
Thanks @alexellis

Please sign in to comment.