Skip to content

Test connectivity to the Git or Registry host before accessing the source#1762

Merged
openshift-merge-bot[bot] merged 2 commits into
shipwright-io:mainfrom
SaschaSchwarze0:sascha-test-connection
Jan 7, 2025
Merged

Test connectivity to the Git or Registry host before accessing the source#1762
openshift-merge-bot[bot] merged 2 commits into
shipwright-io:mainfrom
SaschaSchwarze0:sascha-test-connection

Conversation

@SaschaSchwarze0

@SaschaSchwarze0 SaschaSchwarze0 commented Dec 27, 2024

Copy link
Copy Markdown
Member

Changes

This aims to mitigate rare failures where a BuildRun pod runs in a namespace with NetworkPolicies present. Kubernetes defines that isolation rules are guaranteed to be applied before any container of the Pod is started, but allow rules are eventually applied. See https://kubernetes.io/docs/concepts/services-networking/network-policies/#pod-lifecycle: Therefore, pods must be resilient against being started up with different network connectivity than expected

I am therefore extending the logic of the Git and OCI artifact source steps to test connectivity as these are the first containers in a BuildRun pod that actually require network connectivity. And given we own them, we should be resilient.

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

Release Notes

The source steps for sources of type Git and OCIArtifact now check the connectivity of the endpoint before entering the main download logic. This should eliminate failures caused by BuildRuns running in namespaces with NetworkPolicies that define that allow rules are only eventually applied.

@SaschaSchwarze0 SaschaSchwarze0 added the kind/bug Categorizes issue or PR as related to a bug. label Dec 27, 2024
@SaschaSchwarze0 SaschaSchwarze0 added this to the release-v0.15.0 milestone Dec 27, 2024
@openshift-ci openshift-ci Bot added the release-note Label for when a PR has specified a release note label Dec 27, 2024
@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 27, 2024

@HeavyWombat HeavyWombat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice! Thanks for the PR. I just found some minor things, which I think should be addressed.

Comment thread pkg/git/git.go Outdated
Comment thread cmd/bundle/main.go Outdated
Comment thread cmd/git/main.go Outdated
Comment thread pkg/image/endpoint.go Outdated
SaschaSchwarze0 and others added 2 commits January 5, 2025 09:14
…urce

This aims to mitigate rare failures where a BuildRun pod runs in a namespace with NetworkPolicies present. Kubernetes defines that isolation rules are guaranteed to be applied before any container of the Pod is started, but allow rules are eventually applied.

Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
Co-authored-by: Matthias Diester <mddiester@gmail.com>
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>

@HeavyWombat HeavyWombat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jan 7, 2025
@openshift-ci

openshift-ci Bot commented Jan 7, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HeavyWombat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2025
@openshift-merge-bot openshift-merge-bot Bot merged commit bcd4ca2 into shipwright-io:main Jan 7, 2025
@SaschaSchwarze0 SaschaSchwarze0 deleted the sascha-test-connection branch August 28, 2025 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants