[K9VULN-2634] ci: test that the Docker container can actually be built and run #609
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem are you trying to solve?
This is a follow-up PR to #600, where we noticed that our Docker container could be failing to build, and CI would not let us know of this failure. Currently, the only time we build the Docker container is when we trigger a release workflow, and not during any commit push or PR, which is not ideal. This should be tested in CI
What is your solution?
I've added a workflow that runs on commit pushes and PRs that builds the Docker container, and verifies the binaries can be executed. The workflow is simple, and involves four steps:
datadog-static-analyzer
,datadog-static-analyzer-server
, anddatadog-static-analyzer-git-hook
)Additionally, our release process could run into a situation where our GH release works just fine, but the GHCR workflow fails, thus leading to our release version and container version being out of sync. As such, I've made the docker workflow a pre-requisite for the release job in the release workflow.
A successful run of the workflow can be found here.
A successful run of the release workflow, with the docker build workflow being a required step, can be found here
Alternatives considered
What the reviewer should know
Note that Docker is a preinstalled software in GitHub actions, and we don't need any additional functionality that a specialized action might provide for us, as all we're looking to do is build and run a local container.
If the Docker invocation of the binary fails, then the job does indeed fail, as seen here (this failed because I hadn't passed in
--help
).