Closed Kaskarden closed 3 months ago
Hi! The idea of the tool - to keep all cleanup policies in text format so you can push it to version control system, review and use other best tool and practice for the code. Everything as Code! It's fine to keep secret or connection URL in environment variables tho.
I don't see why one would need to change repo name via command line or environment variable. Could you explain it? There ought to be serious reason for that change
Btw, don't bump version in PR if you contribute to a project if reviewer didn't ask it explicitly. It can lead to unnecessary conflicts while merging
The problem that I was trying to solve was this: I have different artifactory "environments" (development, test, etc.). The way these are seperated is by repo name. I want to automatically clean all environments with the same configuration. The command line script I wrote determines which environment it needs to clean by determining which environment it is run in. Currently I have to write different policies to seperate the different environments, which makes it hard to read the configuration. It would be a lot easier if I could just substitute the repo name according to which environment I'm in. And sorry for bumping the version
The Artifactory URL and username/password for environments are the same or different?
The URL is the same, the username and password combination is also determined by the script and then substituted accordingly
I see.
Here's what I'd suggest you to do instead of changing a repo name at the runtime.
- name: dev-repo
rules:
- rule: Repo
name: repo.dev
- name: stg-repo
rules:
- rule: Repo
name: repo.stg
artifactory-cleanup --policy dev-repo --username DEV_USER
artifactory-cleanup --policy stg-repo --username STG_USER
Would it solve your case? If it doesn't - please describe the case more, may be add few examples and we'll see how it can fit in the project!
If we can't solve it with the current tool - I'll look at PR closely and may be we can add the functionality to the project.
Everything is a Code is the best one
added functionality to use an environment variable so you don't have to hardcode the repo name into the config yaml bumped version to 1.0.7