-
Notifications
You must be signed in to change notification settings - Fork 6
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
[READY] - add ansible-lint image #49
[READY] - add ansible-lint image #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this PR @kylerisse!
This method seems like a much better alternative to the "standard" ansible lint github action so others might find it useful. There's also an opportunity to add this to some existing internal projects.
I agree, I think theres a lot of need for this given the situations we find ourselves in with ansible
I wasn't 100% sure how to test this, so I created a nix shell with the same code and ran it with --pure. I then used the shell to validate against some existing repos. I also manually ran through the lint workflow using docker. I would love some further guidance on the best way to validate this before marking READY.
Ah ya the docs really dont call this out 😞 Sounds like the majority of your testing when well though and seems to be valid checks as well. Regarding the overlay if you wanted to test your changes more directly you can also:
cd <repo root>
nix-build -A imgs.ansible-lint
The build should produce a result
that can be verified and matched the CI build
The result you build locally can also then be tested into docker with something like:
docker load < result
Itll be named nebulaworks/ansible-lint
so then you should be able to just:
docker docker run -t nebulaworks/ansible-lint:latest
That should more or less work for you locally. Let me know how that does when you get a chance to try it out. We should probably update our docs with this basic sanity check. Its also called out in a good ref here: https://nix.dev/tutorials/building-and-running-docker-images
02e50af
to
22bb84b
Compare
Thanks @sarcasticadmin, it all worked as described. I went ahead and updated the README with these steps as well. |
22bb84b
to
8cde894
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kylerisse considering with how much we've leveraged ansible
across our engagements to date, this seems like a fine addition!
@@ -5,3 +5,11 @@ so that the output of the image is `ALWAYS` reproducible. This has been a long s | |||
of docker images and `Dockerfile`. | |||
|
|||
All images are currently hosted in on Dockerhub: https://hub.docker.com/u/nebulaworks | |||
|
|||
## Local Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this note!
nwi = import ../../nwi.nix; | ||
lib = pkgs.lib; | ||
customPython = with pkgs; python310.withPackages | ||
(pythonPackages: with pythonPackages; [ ansible-lint pylint pytest yamllint ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks like we only have the one interpreter now :)
# make sure /tmp exists | ||
mkdir -m 1777 tmp | ||
mkdir -p usr/bin | ||
ln -s ${pkgs.coreutils}/bin/env usr/bin/env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the way
@@ -0,0 +1,5 @@ | |||
# ansible-lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding a description
@kylerisse go ahead and test out the comment build. We still have to fix that docker v1 vs v2 api oddity (at a later date) |
publish |
8cde894
to
a3fbd1d
Compare
publish |
2 similar comments
publish |
publish |
Ok figured out the initial error since you were on a fork and raise the PR from there apparently v1 doesnt deal with this well 🤦 actions/checkout#318 So i pushed up your branch to the repo directly but it looks like cachix needs to help too: https://github.com/Nebulaworks/nix-garage/runs/6044782853?check_suite_focus=true#step:5:6 will look into this a little later but were close! |
a3fbd1d
to
d553f7d
Compare
publish |
(also force pushed the rebased branch to this repo's branch of the same name to avoid the actions v1 checkout forks issue) |
Failed https://github.com/Nebulaworks/nix-garage/runs/6166702535?check_suite_focus=true |
@kylerisse Thanks for testing this. Im glad the cachix stuff is no longer the issue and this this is reproducible. The issue seems to be with the revision of the
We have a couple of options as I see it:
As Im writing this I feel like option 3: |
@kylerisse sorry didnt mean to close |
We could probably mitigate the cons of either option 1 or 3 by wrapping usage in a |
d553f7d
to
52e7399
Compare
👀 |
publish |
The following docker images: |
publish |
The following docker images: |
|
This is a weird one. So it seems to bomb out on Line 58 in b80ecae
but only from a clean state. I was able to get the derivation it's complaining about to build by removing
Then the original command works
and then garbage collect with
which is probably why we didn't catch it in the other PR, since prior to testing I'm not sure what the best way to "pre-build" the derivation, but I'm pretty sure this is the condition in the clean container. |
here's a simplified way to reproduce the base condition
|
publish |
The following docker images: |
@sarcasticadmin so a couple things fall out of this. |
Im not really sure what alternatives we have either? I wouldnt be opposed to just leaving this and commenting why it exists for the time being. As am looking through the docs it seems like maybe the flag
You call out in the above comments #49 (comment) this failure scenario with a clean /nix/store makes sense why --eval doesnt work
Ya we need to blow up fantastically instead, totally agree with a follow up to try to make the failure here more obvious going forward. I think a separate issue in the backlog is fine vs fixing it here |
d20f3dc
to
84f8cd1
Compare
Sounds good @sarcasticadmin
Added more detailed comment around this here
opened an issue for the other problem here |
@@ -55,6 +55,14 @@ attr=${1:-'imgs'} | |||
# For storing all built and published images | |||
BUILT=() | |||
|
|||
# When using a non-blank ${nixtop} (such as in CI), a new derivation will have to be built |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect thanks for adding this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @kylerisse thanks for working through this with me |
Description of PR
Adds a new image for
ansible-lint
with some typical complementary tools such asyamllint
,pytest
,pylint
,jq
,git
, etc. Immediate use case is for github actions in the CI workflow for SCaLE network. This method seems like a much better alternative to the "standard" ansible lint github action so others might find it useful. There's also an opportunity to add this to some existing internal projects.Tests