#156 Create "export_variable" directive
Closed: Fixed None Opened 10 years ago by jskladan.

I would really love to have a directive that would let me to define a variable in the .yml files. Usefull mostly for development, but it is always such a pain to manually replace all the occurences of (say) ${workdir} with something else (and I also tend to make a mistake here or there...).

The directive will take one single argument called "value", that can be of any type, and will just return it, thus making something like this possible:

<snipped />

task:
    - name: set workdir
      export_variable:
          value: "/home/jskladan/tpm/workdir"
      export: workdir

    - name: download koji tag
      koji:
          action: download_tag
          koji_tag: ${koji_tag}
          arch: ['i386']
          target_dir: "${workdir}/downloaded_tag/"

<snipped />

"Production" use-case could be setting ${arch} in the depcheck's .yml file at the beginning of the arch-specific "blocks" (see https://phab.qadevel.cloud.fedoraproject.org/D145#7594e64b for the respective yml file).


This ticket had assigned some Differential requests:
D202

I wonder if we could accomplish something similar by expanding the CLI args for the runner. something like

runtask -i someitem -t sometype -a somearch taskfile.yml --override "workdir=/path/to/workdir othervar=somethingelse"

If so, that seems like a bit cleaner way to do things as it doesn't require modifying the taskyaml for development

That would also be good (and cleaner), and would cover most of my needs, although it would not be able to be used for the depcheck scenario - but to be fair, I do not feel like that is a common use case, and I used it just to add some "real-life" scenario as an usecase.

So in the end I'd probably prefer the CLI scenario, but I'm not sure about the details. I guess overriding the variables just once (at the beginning) would be preferred (and easy) way to do this.

Metadata Update from @jskladan:
- Issue tagged with: easyfix

6 years ago

Log in to comment on this ticket.

Metadata