Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treefile: allow ${releasever} in more keys #1848

Closed
wants to merge 1 commit into from

Conversation

r4f4
Copy link
Contributor

@r4f4 r4f4 commented Jun 4, 2019

Fixes #1809

Is this the right idea?

@lucab
Copy link
Contributor

lucab commented Jun 4, 2019

I would suggest to have a single map with all the variables, and substitute them all at once.

If it can be helpful, I was recently going through a similar usecase (not sure if it has the exact same semantics) for which I put together https://docs.rs/envsubst (example of a consumer: https://github.com/coreos/zincati/pull/21/files).

@r4f4 r4f4 force-pushed the releasever branch 2 times, most recently from 1a60ec4 to 11a5baf Compare June 4, 2019 17:34
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
@r4f4
Copy link
Contributor Author

r4f4 commented Jun 5, 2019

Thank you for the feedback. I see I'm in the right direction so I'll work on a functional and tested PR.

@r4f4
Copy link
Contributor Author

r4f4 commented Jun 6, 2019

It seems I can't rely on dnf_context_get_release_ver because for the treecompose/container case it's set to rpmostree-unset-releasever. I guess instead of getting this value from ror_treefile_new argument, I should just check for the releasever key in the treefile yaml.

@r4f4 r4f4 changed the title WIP: treefile: allow ${releasever} in more keys treefile: allow ${releasever} in more keys Jun 7, 2019
@r4f4 r4f4 marked this pull request as ready for review June 13, 2019 14:44
@cgwalters
Copy link
Member

I guess instead of getting this value from ror_treefile_new argument, I should just check for the releasever key in the treefile yaml.

Yeah, that's the idea, see b46fc35 (which I got from git log -G unset-releasever)

rust/src/treefile.rs Outdated Show resolved Hide resolved
rust/src/treefile.rs Outdated Show resolved Hide resolved
@cgwalters
Copy link
Member

Ah sorry so I just thought about this more carefully; this is effectively undoing the change in #1848 (comment) right?

So we shouldn't do the changes to pass the releasever from the dnf context down; specifically we want a semantic where e.g. someone using coreos-assembler isn't unintentionally relying on the version of Fedora that the assembler container happens to be using.

I also think we want to do this processing as a final pass on the merged treefile rather than doing it per parse. This way we have the (IMO) expected semantics where one could do:

include: "fedora-coreos.yaml"
releasever: "42"

And have that releasever used.

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably dbf28ac) made this pull request unmergeable. Please resolve the merge conflicts.

Besides allowing ${releasever}, only do the substitution as the final
pass after merging the treefiles for all the keys (currently ${basearch}
and ${releasever}) instead of doing it per parse. This way we have the
expected semantics where one could do:

```
include: "fedora-coreos.yaml"
releasever: "42"
```

and have that releasever used.

Fixes coreos#1809

Signed-off-by: Rafael Fonseca <[email protected]>
@r4f4
Copy link
Contributor Author

r4f4 commented Jun 18, 2019

Improved commit message and changed the substitution to happen after the merges as suggested.

@cgwalters
Copy link
Member

Awesome, thanks!

@rh-atomic-bot r+ 94d79dd

rh-atomic-bot pushed a commit that referenced this pull request Jun 18, 2019
Besides allowing ${releasever}, only do the substitution as the final
pass after merging the treefiles for all the keys (currently ${basearch}
and ${releasever}) instead of doing it per parse. This way we have the
expected semantics where one could do:

```
include: "fedora-coreos.yaml"
releasever: "42"
```

and have that releasever used.

Fixes #1809

Signed-off-by: Rafael Fonseca <[email protected]>

Closes: #1848
Approved by: cgwalters
@rh-atomic-bot
Copy link

⌛ Testing commit 94d79dd with merge 6ad5e8d...

@rh-atomic-bot
Copy link

💔 Test failed - status-atomicjenkins

@jlebon
Copy link
Member

jlebon commented Jun 18, 2019

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit 94d79dd with merge c94bd08...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing c94bd08 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ${releasever} in more keys
5 participants