Repository np-reddy/git-issue-ops is used for defining the necessary objects and workflows to create repository in Artifactory.
- Issue template to capture details of github repo from which users needs to be synced to artifactory, artifactory repo type and package type.
- Artifactory Pro or Enterprise which is accessible from internet or from the actions runner (if using self-hosted).
- Setup JFrog CLI on your local machine, export the token/key and save it as secret in your GH repo.
- Generate and save github token with organization owner access.
- Create and modify Artifactory object creation action workflow according to your environment.
- Create and modify Artifactory templates that suits your requirements.
- User creates an issue using Issue template and provides following details.
github.repo.name=devops1
arti.repo.type=local
arti.repo.package=ivy
- Actions workflow is designed to trigger on issue opened (also, edited for testing the workflow) and checks for issue label arti-repo defined in our issue template.
- Workflow can run on either GitHub-Hosted (ubuntu-latest) or self-hosted (ex.mylaptop).
- Checkout the code from the repo using actions/checkout@v1
- Parse the issue description and extract gh repo, rt repo type, pkg type. Store them in separate files on runner workspace so that these can be retrieved from other jobs whenever needed. Passing global env variables is also considered for passing variables but it is more complex (for me, at least 😉) and error prone.
- Get the gh repo user permissions using collaborators api call and map them into admins, readers and writers based on the repo permissions, copy these to separate files on workspace.
- Set the JFrog CLI env using jfrog/setup-jfrog-cli@v1
- Prepare necessary object creation templates and set env varibales.
- Create arti users and set default passowords and dummy emails (It is not possible to retrieve emails from GH if user chose the email to be private, not even from commit logs, I tried 🤷 ) Note: User validation if already present is not included, will be considered for enhancements.
- Create arti groups and assign the users according to the user maps we have created earlier.
- Create arti repo using env variables and arti repo template. Note: Only local repos can be created for now.
- Create arti permission target using permission template and env varibales, this will tag the repos and groups with required access. Note: Users are excluded from perm target as it is less complex to use groups.
Now, all the required objects are created in Artifactory and ready for use.
Enhancements to be Planned
- Issue description validation for gh repo-name, arti repo-type, arti repo-pkg.
- Validation for existing users and repos in artifactory
- Creation of remote repos
- Feedback to issue after object creation by using comment.