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

Fn: provider in position: 1 is nil. ComposingConfigurationProvider does not support nil values #228

Open
simengineering opened this issue Jun 16, 2022 · 2 comments

Comments

@simengineering
Copy link

simengineering commented Jun 16, 2022

fn create context zonea --provider oracle
fn use context zonea
fn update context oracle.compartment-id $COMPID
fn update context api-url $API_URL
fn update context registry $ARTIFACTORY

fn create app image-import --annotation oracle.com/oci/subnetIds='["$SUBNET"]'

returns error : Fn: provider in position: 1 is nil. ComposingConfigurationProvider does not support nil values

fn list contexts

CURRENT NAME PROVIDER API URL REGISTRY
default default http://localhost:8080

@arun-siv
Copy link

I also get the same error

@vini-hap-biofy
Copy link

Was experiencing this same error when trying to run the fn deploy command inside a GitHub action.

Even if using the Run an Oracle Cloud Infrastructure (OCI) CLI" command action before, to confirm I was authenticated, the same error occurred.

Turns out the Fn CLI tool does not support authentication via the environment variables that the OCI CLI can use (OCI_CLI_USER, OCI_CLI_TENANCY, OCI_CLI_FINGERPRINT, OCI_CLI_KEY_CONTENT, OCI_CLI_REGION). It always tries to look for the OCI configuration files inside the $HOME/.oci/ folder. This is very unfortunate, as those files would never get created in an environment where oci config can't be run, as it is an interactive script.

The only solution I found for now was creating all these files manually inside the action, running the Fn CLI commands, and then deleting all the files. This needs to be done in the same step, or else sensitive info (such as your OCI private key) will be exposed in the Docker layers.

Here's an example:

- name: Run Fn CLI commands
  run: |-
    mkdir "${HOME}/.oci" &&
    echo "${{ secrets.OCI_API_KEY }}" > ${HOME}/.oci/oci_api_key.pem &&
    echo "[DEFAULT]
    user=${{ secrets.OCI_USER }}
    fingerprint=${{ secrets.OCI_API_KEY_FINGERPRINT }}
    key_file=${HOME}/.oci/oci_api_key.pem
    tenancy=${{ secrets.OCI_TENANCY_ID }}
    region=${{ vars.OCI_REGION }}" > "${HOME}/.oci/config" &&
    fn -v deploy --app my-app &&
    rm -rf "${HOME}/.oci/"

Only by doing this the Fn commands started working correctly.

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

No branches or pull requests

3 participants