Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Adding Github Action to run Container Diff #286

Merged
merged 13 commits into from
Jan 16, 2019
Merged

Adding Github Action to run Container Diff #286

merged 13 commits into from
Jan 16, 2019

Conversation

vsoch
Copy link
Contributor

@vsoch vsoch commented Jan 9, 2019

This pull request will add a folder, "actions" that has inside a Dockerfile, entrypoint, and instructions for using container-diff within Github Actions. The simplest example is just to run container-diff as part of a workflow:

workflow "Run container-diff isolated" {
  on = "push"
  resolves = ["Run container-diff"]
}
action "Run container-diff" {
  uses = "GoogleContainerTools/container-diff/actions@master"
  args = ["analyze vanessa/salad --type=file --output=/github/workspace/data.json --json"]
}

You could also list the data.json to show it's available for the next step:

workflow "Run container-diff isolated" {
  on = "push"
  resolves = ["list"]
}
action "Run container-diff" {
  uses = "GoogleContainerTools/container-diff/actions@master"
  args = ["analyze vanessa/salad --type=file --output=/github/workspace/data.json --json"]
}
action "list" {
  needs = ["Run container-diff"]
  uses = "actions/bin/sh@master"
  runs = "ls"
  args = ["/github/workspace"]
}

Which is what I did during testing:

image

And the general expectation is that the user would then do some additional step in the workflow that uses the data. For example, I'm going to use it to create an interactive tree diagram of the container (using the --type=file output) and then push it back to github pages.

I don't see need for different kinds or levels of actions (e.g., a subfolder in a repository can have a different Dockerfile or with a different branch) so I made just one actions folder with the Dockerfile at the root, but if you see reason to add specific ones let's chat about that.

@vsoch
Copy link
Contributor Author

vsoch commented Jan 9, 2019

I'm not familiar with the setup with GoLang, but it looks like some kind of boilerplate (or ignore file?) is missing here?

Checking boilerplate...
Boilerplate missing in: ././actions/Dockerfile
././actions/entrypoint.sh.
make: *** [test] Error 1
/home/travis/.travis/job_stages: line 523:  3893 Terminated              travis_jigger "${!}" "${timeout}" "${cmd[@]}"
The command "travis_wait make test integration" exited with 2.

Let me know how to fix this up.

@vsoch
Copy link
Contributor Author

vsoch commented Jan 9, 2019

oup, found it! Disregard question :)

Copy link
Contributor

@nkubala nkubala left a comment

Choose a reason for hiding this comment

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

I'll admit I don't totally understand the configuration for Github Actions....but this is cool! :)

@nkubala nkubala merged commit 6d827eb into GoogleContainerTools:master Jan 16, 2019
@vsoch
Copy link
Contributor Author

vsoch commented Jan 16, 2019

Awesome! If you have some random free time, definitely try them out. It's akin to any continuous integration, but all within Github (so if you needed to share your GITHUB_TOKEN with an external service, you wouldn't need to. Any repository can provide an action, in any subfolder, and the Dockerfile in that subfolder drives it! So for container-diff, I added the "actions" folder, and within someone's workflow (in a different repository) they would reference the action like:

workflow "Run container-diff isolated" {
  on = "push"
  resolves = ["Run container-diff"]
}
action "Run container-diff" {
  uses = "GoogleContainerTools/container-diff/actions@master"
  args = ["analyze vanessa/salad --type=file --output=/github/workspace/data.json --json"]
}

The "uses" key references the repository, and the subfolder "actions" on the master branch. The "args" is where they write the command they want to send to container-diff.

In context of a workflow, this would just be one step! Likely next they would do something with the output. We aren't biased to what is done, we just want to make sure they can easily do it :)

@vsoch vsoch deleted the add/github-actions branch January 16, 2019 23:03
@MPV MPV mentioned this pull request Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants