summaryrefslogtreecommitdiffstats
path: root/src/job
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-03-01 10:16:42 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-03-01 17:42:26 +0100
commit2d72cbed2495517dba84ec4d46e5f521ff46412b (patch)
tree6a0457bee61f0fb30e49ca3e8cdd1953399e83e9 /src/job
parent6387e8f333aa9f5b65a5ebb8ce3d8ebeaa0fa58c (diff)
Add feature to pass git author and git commit information to container
This patch implements the feature to be able to pass author and commit hash information from the repository to the container. This can be used to set packager or package description commit hash inside the build container, if desired. Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/job')
-rw-r--r--src/job/runnable.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/job/runnable.rs b/src/job/runnable.rs
index 838a4e7..3143e0c 100644
--- a/src/job/runnable.rs
+++ b/src/job/runnable.rs
@@ -55,6 +55,8 @@ impl RunnableJob {
job: &Job,
source_cache: &SourceCache,
config: &Configuration,
+ git_author_env: Option<&(EnvironmentVariableName, String)>,
+ git_commit_env: Option<&(EnvironmentVariableName, String)>,
dependencies: Vec<ArtifactPath>,
) -> Result<Self> {
if config.containers().check_env_names() {
@@ -70,6 +72,8 @@ impl RunnableJob {
.into_iter()
.flatten()
})
+ .chain(git_author_env.as_ref().into_iter().map(|(k, v)| (k, v)))
+ .chain(git_commit_env.as_ref().into_iter().map(|(k, v)| (k, v)))
.inspect(|(name, _)| debug!("Checking: {}", name))
.try_for_each(|(name, _)| {
trace!("{:?} contains? {:?}", config.containers().allowed_env(), name);
@@ -100,6 +104,8 @@ impl RunnableJob {
.filter(|jr| jr.env().is_some())
.cloned()
})
+ .chain(git_author_env.into_iter().cloned().map(JobResource::from))
+ .chain(git_commit_env.into_iter().cloned().map(JobResource::from))
.collect();
debug!("Building script now");