Skip to content
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

Fix test output #88

Closed
wants to merge 50 commits into from
Closed

Fix test output #88

wants to merge 50 commits into from

Conversation

northdpole
Copy link
Contributor

this pr extends #62 by adding tests for all consumers who have the ability to write ScanInfo Tags

The third_party folder is used by please to declare and vendorize third
party dependencies. It is no longer needed.

Signed-off-by: Pavlos Tzianos <[email protected]>
Signed-off-by: Pavlos Tzianos <[email protected]>
The Helm Charts were originally automatically generated by please but
now they will be explicitly hardcoded.

Signed-off-by: Pavlos Tzianos <[email protected]>
Our kustomizations where not referencing the base component pipeline
YAML which caused an error when trying to build the pipelineruns.
We also hardcode the namespace to dracon in all the kustomizations,
which is something that the user should be able to choose

Signed-off-by: Pavlos Tzianos <[email protected]>
Changes:
* Remove all BUILD files from the directories of the kustomize-component-generator
* move the library into the pkg folder and the main into `cmd/component-generator`
* fix the import paths to reflect new reality
* add make targets to produce the binary and store it in the bin folder

Signed-off-by: Pavlos Tzianos <[email protected]>
…t of #62)

This commit is the last commit cleaning up the third_party directory.
This directory is supposed to contain any resources that are imported
from third parties as the name suggests. The only resources that we are
importing from third parties at the moment are two shell scripts with
helpers for beautifying the output of our shell scripts and the TektonCD
OpenAPI spec which is used by us to produce OpenAPI schemas for the
CRDs.

Signed-off-by: Pavlos Tzianos <[email protected]>
Signed-off-by: Pavlos Tzianos <[email protected]>
This commit removes all BUILD files from the components and replaces
them with two scripts in the scripts folder and make targets that
automate building all component containers. The Go binaries are first
build using a make target with the `/bin` suffix and the path of the
directory of the component. The binaries are then packaged into
containers using `docker`. Each container is tagged with a tag that is
produced based on the git tag of the commit. If the current commit is
not tagged, the container tag will be the commit SHA + how many commits
ahead of the latest tagged commit + the latest tag in the branch's
history.
For some components, extra functionality is needed because we use a
different name for the component or some extra functionality. For these
cases, we allow a special Makefile to be placed in the directory and we
expect targets with specific names to be present. If they are, the top
level Makefile will invoke them and allow them to build the component in
whatever way they want.

Changes

Signed-off-by: Pavlos Tzianos <[email protected]>
The  dev deployment is now based entirely on Helm packages. The Helm
packages are invoked using the `dev-deploy` target which uses various
other targets as dependencies to ensure that all Dracon dependencies are
deployed with one command.

Signed-off-by: Pavlos Tzianos <[email protected]>
ptzianos and others added 20 commits February 15, 2024 10:12
Remove all please related lint commands and refactor Github action to
use the newly introduced lint make target.
The lint make target invokes in turn reviewdog with the proper
configuration that allows multiple tools to be executed in parallel and
output configuration. For the Github action we make sure to invoke
reviewdog only on the changes introduced in the PR to avoid having to
correct existing issues that already existed as a prerequisite of
landing a PR.

Signed-off-by: Pavlos Tzianos <[email protected]>
Refactors the Github test action to use the newly introduced test make
target that invokes go test for all the packages of the repo. The user
is able to modify which go packages are being tested using the
GO_TEST_PACKAGES environment variable when invoking the make command.

Signed-off-by: Pavlos Tzianos <[email protected]>
The Github action checking the format of the code has been refactored to
use the newly introduced make target which formats the code. If the
Github action discovers that the formatting tools have introduced
changes to the codebase it will fail. That way the contributor can be
notified that the code is not formatted according to the standards.

Signed-off-by: Pavlos Tzianos <[email protected]>
A lot of tests in the pkg where not checking properly for errors
returned by various function calls. We also used the `assert.Nil`
function for checking for the existence of errors, instead of the
`require.NoError` which has clearer semantics and will force the tests
to stop immediately if an error has been returned.
Finally, in many tests we included the testdata in the GO code which
means that changing the data would make it look like we changed the test
code itself. The test data where moved into separate folders to make the
code clearer to read.

Signed-off-by: Pavlos Tzianos <[email protected]>
A lot of tests for our components where not checking properlu for the
existence of errors, an issue that was identified by the linters and is
now fixed. We also switched to using `require.NoError` to make sure that
tests will stop if an error is returned anywhere. Finally, in some
tests, testdata where included as variables in the code, which have now
been split into their own files for more clarity.

Signed-off-by: Pavlos Tzianos <[email protected]>
The kustomize component generator refactoring was unsuccessful. A lot
of time was spent reworking something that ultimately will never work
well, due to the fact that there is some flag that we are missing when
the kustomize build command that prevents the output from being the
expected one, and the JSON 6902 patches are missing some functionality
that would allow us to make them work for us, such as appending to a
list that is a field of the last element of an existing list.
This lead us to rethink the way we do thinks and start transitioning to
a more abstract way of producing our pipelines that doesn't involve
kustomize at all. That is the beginning of the draconctl tool. That tool
will eventually include other utilities that will allow users to perform
a lot of actions related to the project easily. For the time being the
first command include is the `pipeline build` command that produces a
pipeline for Tekton. In the future we could add other backends such as
simple bash scripts that run the pipelines in demo environments where
there is no Docker or K8s available, different CI/CD platforms like Argo
CI/CD, etc or Github actions.
The new command accepts a path to a directory where a kustomization file
is located listing all the bases and the components that will be added
to the pipeline. It is able to parse a Kustomization, so it's already
compatible with all our pipelines. But it allows us to implement
arbitrary logic to the construction of our pipelines, since we now have
the full context of all the tasks involved in generating a pipeline.
This commit also adds the ability to add arbitrary tags to the scan
pipeline that are passed throughout and can help a user add more
metadata to the results of the scans.

Signed-off-by: Pavlos Tzianos <[email protected]>
Signed-off-by: Pavlos Tzianos <[email protected]>
@northdpole
Copy link
Contributor Author

was merged as part of #53

@northdpole northdpole closed this Mar 17, 2024
@ptzianos ptzianos deleted the fix-test-output branch September 21, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants