Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Docker backend for Gems #43

Merged
merged 12 commits into from
Dec 9, 2021
Merged

Docker backend for Gems #43

merged 12 commits into from
Dec 9, 2021

Conversation

da-ar
Copy link

@da-ar da-ar commented Dec 6, 2021

This PR enables the PRM functionality that allows a GEM tool to be executed using the Docker backend.

When run will look in the current working directory for a validate.yml. It wil then execute against all these tools.
This needs removed from the prm exec exec and only used in prm validate. However it demonstrates the functionaliy.

dist\prm_windows_amd64\prm.exe exec

This command will look in the tools directory for a config that matches puppetlabs/rubocop.

dist\prm_windows_amd64\prm.exe exec puppetlabs/rubocop

If found it will:

  • parse the config into the data structure
  • check if docker has an image that matches a unique name made up of the author, id, version of the tool and the user configured puppet version
  • if no image is present it will generate dockerfile based on the tool config and create the image on the local system
  • when the image is created it will then create and run the conatiner against the codedir.
  • It will output to stdout the response from the tool

@da-ar da-ar force-pushed the gh-35/main/docker-backend branch 12 times, most recently from be09f1b to 1ca4888 Compare December 9, 2021 10:38
@da-ar da-ar marked this pull request as ready for review December 9, 2021 11:19
@da-ar da-ar requested a review from a team as a code owner December 9, 2021 11:19
Copy link

@sanfrancrisko sanfrancrisko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work @da-ar ! 🥇

pkg/prm/docker.go Outdated Show resolved Hide resolved
@da-ar da-ar force-pushed the gh-35/main/docker-backend branch from 1ca4888 to e10c8a0 Compare December 9, 2021 12:53
Copy link
Contributor

@michaeltlombardi michaeltlombardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this rules, unbelievably happy to see this come so far so fast; a few questions and suggestions but otherwise 🎉

cmd/exec/exec.go Outdated Show resolved Hide resolved
cmd/exec/exec.go Outdated Show resolved Hide resolved
cmd/exec/exec.go Outdated Show resolved Hide resolved
pkg/prm/docker.go Outdated Show resolved Hide resolved
pkg/prm/docker.go Show resolved Hide resolved
pkg/prm/docker.go Show resolved Hide resolved
pkg/prm/docker.go Show resolved Hide resolved
pkg/prm/prm.go Outdated Show resolved Hide resolved
pkg/prm/prm.go Outdated Show resolved Hide resolved
@da-ar da-ar force-pushed the gh-35/main/docker-backend branch from 2792930 to 20b0cd4 Compare December 9, 2021 13:26
@da-ar da-ar force-pushed the gh-35/main/docker-backend branch from 20b0cd4 to 2b8d763 Compare December 9, 2021 13:53
Copy link
Contributor

@michaeltlombardi michaeltlombardi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥁 🦖 💥

da-ar added 3 commits December 9, 2021 15:19
```
gem:
  compatibility:
    - 2.5:
      - "puppetlabs_spec_helper": "2.15.0"
    - 2.4:
      - "puppetlabs_spec_helper": "2.15.0"
```
This flag allows arguments to be passed to the tool. We are unable to rely on cobra to pass unknown args and flags.
@da-ar da-ar force-pushed the gh-35/main/docker-backend branch from 2b8d763 to 7fa4180 Compare December 9, 2021 15:20
@michaeltlombardi michaeltlombardi merged commit 96a605f into main Dec 9, 2021
@michaeltlombardi michaeltlombardi deleted the gh-35/main/docker-backend branch December 9, 2021 15:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants