#Convert secret to dagger file

1 messages · Page 1 of 1 (latest)

silver swallow
#

Hi there, I am starting a dagger service which receives dagger.File for its configuration. I would like to run this in GH actions and I need to store the configuration file as a secret. I know how to retrieve the plaintext from secrets, but I don't know how to convert it (a string) to a dagger File... I am using Python SDK.

Does anyone know how to create a dagger File "on the fly" starting from a python string or a secret?

Thank you!

#

Ideally, I would like something like

from dagger import dag
config = """
foo: 123
bar: 234
"""
my_file: dagger.File = dag.file().from_str(config) 
sour grail
#

Try:

my_file = dag.directory().with_new_file("file_name", config).file("file_name")
#

Warning that if you create a dagger.File from a secret it gets leaked in the engine, i.e., not safe.