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

Add changes for onboarding PAC to Konflux #1795

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

savitaashture
Copy link
Member

@savitaashture savitaashture commented Oct 25, 2024

Changes

This PR integrates PAC into Konflux, an open-source,
cloud-native software factory that prioritizes software supply chain security.
By leveraging Konflux, PAC can now be built and released with enhanced security and consistency.
Konflux ensures all images are built hermetically, prefetching dependencies
in advance to eliminate runtime internet downloads.
Additionally, it enforces policy checks to verify that all preconditions
are satisfied, reinforcing compliance and reliability during the build process.

Signed-off-by: savitaashture [email protected]

Submitter Checklist

  • 📝 Please ensure your commit message is clear and informative. For guidance on crafting effective commit messages, refer to the How to write a git commit message guide. We prefer the commit message to be included in the PR body itself rather than a link to an external website (ie: Jira ticket).

  • ♽ Before submitting a PR, run make test lint to avoid unnecessary CI processing. For an even more efficient workflow, consider installing pre-commit and running pre-commit install in the root of this repository.

  • ✨ We use linters to maintain clean and consistent code. Please ensure you've run make lint before submitting a PR. Some linters offer a --fix mode, which can be executed with the command make fix-linters (ensure markdownlint and golangci-lint tools are installed first).

  • 📖 If you're introducing a user-facing feature or changing existing behavior, please ensure it's properly documented.

  • 🧪 While 100% coverage isn't a requirement, we encourage unit tests for any code changes where possible.

  • 🎁 If feasible, please check if an end-to-end test can be added. See README for more details.

  • 🔎 If there's any flakiness in the CI tests, don't necessarily ignore it. It's better to address the issue before merging, or provide a valid reason to bypass it if fixing isn't possible (e.g., token rate limitations).

@savitaashture
Copy link
Member Author

/test linters

RUN groupadd -r -g 65532 nonroot && useradd --no-log-init -r -u 65532 -g nonroot nonroot
USER 65532

ENTRYPOINT ["/ko-app/pipelines-as-code-webhook"]
Copy link
Member

@chmouel chmouel Oct 28, 2024

Choose a reason for hiding this comment

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

those three Docker files are copy and paste to each others, can't be use a ARG to generate multiple image with one ?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure if buildah has the option ; I hope it does — if it does, we my be able to try that out (but same as commented elsewhere, we need to update our tool)

Copy link
Member Author

@savitaashture savitaashture Oct 28, 2024

Choose a reason for hiding this comment

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

actually we can have one dockerfile for all 3 binaries similar to what we have in downstream p12n repo

COPY --from=builder /tmp/pipelines-as-code-controller ${KO_APP}/pipelines-as-code-controller
COPY --from=builder /tmp/pipelines-as-code-watcher ${KO_APP}/pipelines-as-code-watcher
COPY --from=builder /tmp/pipelines-as-code-webhook ${KO_APP}/pipelines-as-code-webhook

and then in entrypoint we can just use

ENTRYPOINT ["/ko-app/pipelines-as-code-controller"]

But the point is @vdemeester the hack tool refer dockerfile path for each component
we might need to change there

ENV GODEBUG="http2server=0"
RUN go build -mod=vendor -tags disable_gcp -v \
-ldflags "-X github.com/openshift-pipelines/pipelines-as-code/pkg/params/version.Version=${TKN_PAC_VERSION}" \
-o /tmp/tkn-pac ./cmd/tkn-pac
Copy link
Member

Choose a reason for hiding this comment

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

why don't you use the make target instead of using directly your go files?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is mostly because they are coming from downstream, and look very similar to any other openshift-pipelines component's Dockerfile 🙃 (aka at some point, I was thinking of generating it)

Copy link
Member

Choose a reason for hiding this comment

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

well if we want to have this upstream you may use the same target as what we have upstream, having multiple way to compile the binaries across the repository is not really good code hygiene

Copy link
Member Author

Choose a reason for hiding this comment

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

I see make sense

actually this https://github.com/openshift-pipelines/pipelines-as-code/blob/main/Dockerfile and PR dockerfile almost same but base images are different
@vdemeester can we try with existing dockerfile and lets make components to point out to this existing Dockerfile 🤔

@chmouel
Copy link
Member

chmouel commented Oct 28, 2024

do we need a openshift/ directory at the topdir ? can it be in .konflux? I find it weird to have those files in a upstream repository

@vdemeester
Copy link
Member

do we need a openshift/ directory at the topdir ? can it be in .konflux? I find it weird to have those files in a upstream repository

Today we need it (by convention 😅). We could move them elsewhere (under .konflux for example), we just need to update a bit the tool that generates the payloads…

@chmouel
Copy link
Member

chmouel commented Oct 28, 2024

(by convention 😅). We could move them elsewhere (under .konflux for example), we just need to update a bit the tool that generates the payloads…

i'd rather have the less downstream thing directory and files upstream, i don't think those files are anything useful for the normal folks that don't ship a openshift product

@vdemeester
Copy link
Member

i'd rather have the less downstream thing directory and files upstream, i don't think those files are anything useful for the normal folks that don't ship a openshift product

Yeah, that make sense 👼🏼

@chmouel
Copy link
Member

chmouel commented Oct 28, 2024

just to clarify i am fine to have a toplevel .konflux with all things downstream in there but not just many directories across the top level...

@savitaashture
Copy link
Member Author

@vdemeester as per the discussion moved everything under .konflux PTAL
cc @chmouel

@chmouel
Copy link
Member

chmouel commented Nov 5, 2024

some comments are still not addressed:

  • can we have one Dockerfile instead of duplication?
  • can we have it to use the Makefile targets?
  • can we have the top repo Dockerfile that generates our upstream images using those konflux Dockerfile instead or at least have the same kind of compilation/flags etc... if we have this upstream i rather don't have multiple ways in the repo to product images...

@vdemeester
Copy link
Member

can we have one Dockerfile instead of duplication?

Nope, at least not yet 😓. Those Dockerfile are written once and almost never updated (or automatically), so it's not really an issue.

can we have it to use the Makefile targets?

Those are very very similar to others we have elsewhere and to the one we have downstream.

can we have the top repo Dockerfile that generates our upstream images using those konflux Dockerfile instead or at least have the same kind of compilation/flags etc... if we have this upstream i rather don't have multiple ways in the repo to product images...

Well I was thinking the other way. If we get pac upstream, we just have to remove .konflux (and one .tetkon repository) and we are good to go. The idea being to, at least for now, keep our konflux setup segregated from the "upstream" setup.

@chmouel
Copy link
Member

chmouel commented Nov 19, 2024

can you stash and add a better description of the changes please?

@savitaashture savitaashture changed the title Bootstrap the repository structure Add changes for onboarding PAC to Konflux Nov 21, 2024
@savitaashture
Copy link
Member Author

can you stash and add a better description of the changes please?

@chmouel updated please take a look Thank you

@chmouel
Copy link
Member

chmouel commented Nov 21, 2024

I know it's kind of a nitpick but good software hygiene would be to explain what is konflux in the description of the PR and what it does, just adding "Added necessary changes for onboarding PAC to Konflux." like everyone knows what is Konflux is a bit hasted..

I try to make sure for others when making PR to make a great description of what is intended for someone who is doing reviews or for others that follows the project ie: #1826 #1825. I would like to make sure we have the same for other PRs (except if it's a one line change trivial fix obv)

This PR integrates PAC into Konflux, an open-source,
cloud-native software factory that prioritizes software
supply chain security.By leveraging Konflux,
PAC can now be built and released with enhanced security
and consistency. Konflux ensures all images are
built hermetically, prefetching dependencies
in advance to eliminate runtime internet downloads.
Additionally, it enforces policy checks to verify
that all preconditions are satisfied,
reinforcing compliance and reliability during the build process.

Signed-off-by: savitaashture <[email protected]>
@savitaashture
Copy link
Member Author

I know it's kind of a nitpick but good software hygiene would be to explain what is konflux in the description of the PR and what it does, just adding "Added necessary changes for onboarding PAC to Konflux." like everyone knows what is Konflux is a bit hasted..

I try to make sure for others when making PR to make a great description of what is intended for someone who is doing reviews or for others that follows the project ie: #1826 #1825. I would like to make sure we have the same for other PRs (except if it's a one line change trivial fix obv)

Agree @chmouel 👍
Updated now i corrected English with chatgpt

@chmouel
Copy link
Member

chmouel commented Nov 22, 2024

sounds good thanks

@chmouel chmouel merged commit 1b75dfb into openshift-pipelines:main Nov 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants