acoustic-carpenter-78188
09/04/2023, 12:38 AMflytectl 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:
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
# 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/flyteacoustic-carpenter-78188
09/04/2023, 12:38 AM