#2064 Support tag specific environment variables
Merged 2 years ago by tkopecek. Opened 2 years ago by tstellar.
tstellar/koji tag-envvars  into  master

file modified
+3
@@ -293,10 +293,13 @@ 

          if self.internal_dev_setup is not None:

              opts['internal_dev_setup'] = bool(self.internal_dev_setup)

          opts['tag_macros'] = {}

+         opts['tag_envvars'] = {}

          for key in self.config['extra']:

              if key.startswith('rpm.macro.'):

                  macro = '%' + key[10:]

                  opts['tag_macros'][macro] = self.config['extra'][key]

+             elif key.startswith('rpm.env.'):

+                 opts['tag_envvars'][key[8:]] = self.config['extra'][key]

          output = koji.genMockConfig(self.name, self.br_arch, managed=True, **opts)

  

          # write config

@@ -395,6 +395,15 @@ 

    `--old-chroot` option is appended to any mock call. If it is not set,

    mock's default behavior is used.

  

+ You may also specify per-tag environment variables for mock to use.

+ For example, to set the CC environment variable to clang, you could

+ do:

+ 

+ ::

+ 

+     koji edit-tag dnf-fedora-tag -x rpm.env.CC=clang

+ 

+ 

  Using Koji to control tasks

  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  

file modified
+7
@@ -1691,6 +1691,13 @@ 

          value = macros[key]

          parts.append("config_opts['macros'][%r] = %r\n" % (key, value))

      parts.append("\n")

+     envvars = opts.get('tag_envvars', {})

+     for key in sorted(envvars):

+         value = envvars[key]

+         parts.append("config_opts['environment'][%r] = %r\n" % (key, value))

+     if len(envvars):

+         parts.append("\n")

+ 

      for key in sorted(files):

          value = files[key]

          parts.append("config_opts['files'][%r] = %r\n" % (key, value))

This makes it possible to specify an environment variable for a tag
that will be used during builds. e.g.

koji edit-tag -x rpm.env.CC=clang

We should probably add documentation for this new feature.

rebased onto 964e2213f467f97dec4f07f475f75b6d80de6140

2 years ago

rebased onto aa3e9f4fa63fe31f437785ae375b47a381d302b5

2 years ago

I've updated this patch with some documentation about the feature.

pretty please pagure-ci rebuild

2 years ago

after some thinking, I think this is useful feature and if it works, :shipit:

Dropping this line will fix the unittest (or fixing the test is the other option).

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto 8527245

2 years ago

Updated the patch. It seems like the newlines are there to improve readability, so I tried to preserve that while also getting the test to pass.

Metadata Update from @mfilip:
- Pull-request untagged with: testing-ready

2 years ago

'Testing ready' tag was temporarily removed because of conflict in QE build. Will be tagged again soon

Metadata Update from @mfilip:
- Pull-request tagged with: testing-ready

2 years ago

Metadata Update from @mfilip:
- Pull-request untagged with: testing-ready

2 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-ready

2 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

2 years ago

Commit 604f250 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago