<#1546 [Flytectl Feature] Gracefully handle config...
# flyte-github
a
#1546 [Flytectl Feature] Gracefully handle config files with non-standard extensions Issue created by AdrianoKF Describe the feature/command for flytectl We are trying to use
flytectl
inside a Gitlab CI pipeline. Gitlab supports supplying CI variables mounted as files, where the environment variable points to a file containing the value of the CI var - so naturally we tried setting
FLYTECTL_CONFIG
through this mechanism. However, this fails with the following error message when trying to execute any flytectl command:
Copy code
Error:
Unsupported Config Type ""
ERRO[0000]
Unsupported Config Type ""
Apparently, this error message originates in the spf13/viper library used by flytectl through flytestdlib. The error is raised because viper tries to detect the type of the config file from its extension, which is unset in our CI environment (Gitlab names the file identical to the variable name, e.g. the
FLYTECTL_CONFIG
variable will be stored under
/builds/resources/repo_name.tmp/FLYTECTL_CONFIG
). The error is not specific to Gitlab CI, but can be reproduced by pointing
FLYTECTL_CONFIG
at any file without an extension, see below. Steps to reproduce
Copy code
# Note that ./config is a valid YAML flytectl config file
$ export FLYTECTL_CONFIG=$PWD/config
$ cat $FLYTYCTL_CONFIG
admin:
  # For GRPC endpoints you might want to use dns:///flyte.myexample.com
  endpoint: dns:///localhost:30081
  insecure: true
logger:
  show-source: true
  level: 0
storage:
  connection:
    access-key: minio
    auth-type: accesskey
    disable-ssl: true
    endpoint: <http://10.32.16.105:30084>
    region: us-east-1
    secret-key: miniostorage
  type: minio
  container: "my-s3-bucket"
  enable-multicontainer: true

$ flytectl get projects
Error:
Unsupported Config Type ""
ERRO[0000]
Unsupported Config Type ""

$ flytectl version
 A new release of flytectl is available: 0.3.4 → v0.3.4

{
  "App": "flytectl",
  "Build": "8ba75a6",
  "Version": "0.3.4",
  "BuildTime": "2021-10-01 15:37:24.613781861 +0200 CEST m=+0.029412676"
}
Proposed fix Viper offers the
SetConfigName
and
SetConfigType
methods which could be used in flytestdlib instead of
SetConfigFile
if the config file is always assumed to be a YAML file. flyteorg/flyte