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

Custom CA bundle for build-task #1025

Merged
merged 2 commits into from
May 29, 2024

Conversation

ashwindasr
Copy link
Contributor

@ashwindasr ashwindasr commented May 16, 2024

Replicates #942, but for build task

Slack convo

@brunoapimentel
Copy link
Contributor

/ok-to-test

Copy link

sonarcloud bot commented May 17, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ashwindasr ashwindasr changed the title Custom CA bundle for prefetch-dependencies for build-task Custom CA bundle for build-task May 17, 2024
@gbenhaim
Copy link
Contributor

looks good to me, but I would like someone from the build team to approve @mmorhun @chmeliik

Comment on lines +78 to +86
- name: caTrustConfigMapName
type: string
description: The name of the ConfigMap to read CA bundle data from.
default: trusted-ca
- name: caTrustConfigMapKey
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm conflicted about the consistency of these param names.

On the one hand, the buildah task uses UPPERCASE_NAMES, so this is inconsistent. On the other hand, we already dropped the ball in #942

(And in the context of the whole pipeline, the params should be consistent across all the tasks.)

For this PR, I don't really care what you choose. We really need to make the param casing across all tasks consistent. Breaking changes on that scale will be fun 🥲

Copy link
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

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

LGTM, could you just improve the commit message? Custom CA bundle for prefetch-dependencies for build-task doesn't really make sense :)

@yftacherzog
Copy link
Contributor

I think we'd need to do something with the upload-sbom step as well so that it works with self-signed certificate.
I'm not sure whether cosign has such option though. It might be that we need to use --allow-insecure-registry there.

@gbenhaim
Copy link
Contributor

@yftacherzog maybe it can be done in a followup pr?

ca_bundle=/mnt/trusted-ca/ca-bundle.crt
if [ -f "$ca_bundle" ]; then
echo "INFO: Using mounted CA bundle: $ca_bundle"
cp -vf $ca_bundle /etc/pki/ca-trust/source/anchors
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we can symlink instead of copy to avoid creating another copy of the entire bundle in RAM.

For now we end up with 3 copies at least:

  1. The config map
  2. The file in /etc/pki/ca-trust/source/anchors
  3. The resulting bundle file after running update-ca-trust

Maybe we can even mount the config map directly into /etc/pki/ca-trust/source/anchors ?

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe, but we now that this approach works and I don't think the memory overhead is too big.
I think we should proceed with this PR for unblocking @ashwindasr

Copy link
Member

@ifireball ifireball May 22, 2024

Choose a reason for hiding this comment

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

How hard is it to test using ln -s instead of cp ?

@yftacherzog
Copy link
Contributor

@yftacherzog maybe it can be done in a followup pr?

I'm ok with that, but does this change provide added functionality without the upload-sbom task?
If I understand correctly, with this change, running the task will fail on upload-sbom instead of on build.

@chmeliik
Copy link
Contributor

chmeliik commented May 20, 2024

I think we'd need to do something with the upload-sbom step as well so that it works with self-signed certificate. I'm not sure whether cosign has such option though. It might be that we need to use --allow-insecure-registry there.

Good catch 👍

I'm ok with that, but does this change provide added functionality without the upload-sbom task?
If I understand correctly, with this change, running the task will fail on upload-sbom instead of on build.

Now that you mention it, @ashwindasr @gbenhaim what exactly is the purpose of this change? Is it to let the buildah task pull images from / push images to registries with self-signed certs?

Or is it to let any instructions in the Containerfile access any servers with self-signed certs? If it's the latter, I'm pretty sure this PR doesn't achieve it

@gbenhaim
Copy link
Contributor

@yftacherzog, what @ashwindasr needs it to pull images from a registry with self signed certificates.

@ashwindasr
Copy link
Contributor Author

Thanks @yftacherzog

needs it to pull images from a registry with self signed certificates

So do you think this PR would help us fix this issue, or do you think additional changes are required?

@yftacherzog
Copy link
Contributor

Thanks @yftacherzog

needs it to pull images from a registry with self signed certificates

So do you think this PR would help us fix this issue, or do you think additional changes are required?

As far as I understand, it should.

@gbenhaim
Copy link
Contributor

/lgtm

@gbenhaim
Copy link
Contributor

/approve

@gbenhaim gbenhaim enabled auto-merge May 29, 2024 14:05
@ashwindasr
Copy link
Contributor Author

@gbenhaim looks like you're not an approver?

@gbenhaim
Copy link
Contributor

@chmeliik can you please approve the pr?

@gbenhaim gbenhaim added this pull request to the merge queue May 29, 2024
Merged via the queue into konflux-ci:main with commit 650ee6e May 29, 2024
2 checks passed
@ashwindasr ashwindasr deleted the build-task-custom-ca branch May 29, 2024 17:21
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.

None yet

6 participants