To access the OpenFaaS gateway from a CI/CD pipeline you should adapt your job to:
Obtain an id_token with the proper audience.
Authenticate to OpenFaaS with the id_token using the faas-cli pro plugin.
Example .gitlab-ci.yml file:
stages:-buildservices:-docker:dindcache:key:${CI_COMMIT_REF_SLUG}# i.e. masterpaths:-./faas-cli-./templatebuild_job:stage:buildimage:docker:latestvariables:OPENFAAS_URL:https://gw.example.comscript:-docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY-apk add --no-cache git curl-if [ -f "./faas-cli" ] ; then cp ./faas-cli /usr/local/bin/faas-cli || 0 ; fi-if [ ! -f "/usr/local/bin/faas-cli" ] ; then apk add --no-cache curl git && curl -sSL https://cli.openfaas.com | sh && chmod +x /usr/local/bin/faas-cli && cp /usr/local/bin/faas-cli ./faas-cli ; fi-faas-cli plugin get pro-faas-cli pro enable-faas-cli pro auth --token=$ID_TOKEN_1-faas-cli list -n dev-faas-cli ns-faas-cli store deploy -n dev printer --name p1id_tokens:ID_TOKEN_1:aud:https://gw.example.com
Within your GitLab job, you must obtain an id_token with the proper audience aud field set with the address of your OpenFaaS gateway.
Next the faas-cli pro plugin can be used to authenticate to the OpenFaaS gateway using the id_token. It will exchange the token for an OpenFaaS token and save it. The faas-cli can then be used to talk to the gateway.