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

MGMT-16843: Ensure valid hostname during install #788

Merged
merged 1 commit into from Feb 22, 2024

Conversation

CrystalChun
Copy link
Contributor

https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an invalid hostname (e.g. 'localhost', having capital letters, etc.) that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it is valid. A random hostname will be assigned if the current hostname is invalid.

See above issue for an example of the scenario with an invalid hostname fails to install.

/cc @omertuc @gamli75

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 21, 2024

@CrystalChun: This pull request references MGMT-16843 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "4.16.0" version, but no target version was set.

In response to this:

https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an invalid hostname (e.g. 'localhost', having capital letters, etc.) that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it is valid. A random hostname will be assigned if the current hostname is invalid.

See above issue for an example of the scenario with an invalid hostname fails to install.

/cc @omertuc @gamli75

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 21, 2024
@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 21, 2024
Copy link

openshift-ci bot commented Feb 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CrystalChun

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

The pull request process is described here

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 Feb 21, 2024
Copy link

codecov bot commented Feb 21, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (7a2ea37) 56.43% compared to head (a3605aa) 56.28%.

❗ Current head a3605aa differs from pull request most recent head 662bf4c. Consider uploading reports for the commit 662bf4c to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #788      +/-   ##
==========================================
- Coverage   56.43%   56.28%   -0.16%     
==========================================
  Files          15       15              
  Lines        3358     3367       +9     
==========================================
  Hits         1895     1895              
- Misses       1289     1295       +6     
- Partials      174      177       +3     
Files Coverage Δ
src/installer/installer.go 69.29% <60.00%> (-1.04%) ⬇️

@gamli75
Copy link
Contributor

gamli75 commented Feb 21, 2024

@CrystalChun please add a test for hostname with Capital letters

@gamli75
Copy link
Contributor

gamli75 commented Feb 21, 2024

@tsorya please review

https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure
it is valid. A random hostname will be assigned if the current
hostname is invalid.
@openshift-ci openshift-ci bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 21, 2024
if hostname != "localhost" {
i.log.Infof("hostname is not localhost, no need to do anything")

if err := validations.ValidateHostname(hostname); err == nil && hostname != "localhost" {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we can always write requested hostname?
Though this seems fine

@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 22, 2024
@tsorya
Copy link
Contributor

tsorya commented Feb 22, 2024

/lgtm

@openshift-ci openshift-ci bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 22, 2024
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 22, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 9f1f798 into openshift:master Feb 22, 2024
9 of 10 checks passed
@CrystalChun
Copy link
Contributor Author

/cherry-pick release-ocm-2.9

@CrystalChun
Copy link
Contributor Author

/cherry-pick release-ocm-2.8

@CrystalChun
Copy link
Contributor Author

/cherry-pick release-4.15

@CrystalChun
Copy link
Contributor Author

/cherry-pick release-4.14

@openshift-cherrypick-robot

@CrystalChun: #788 failed to apply on top of branch "release-ocm-2.9":

Applying: MGMT-16843: Ensure valid hostname during install
Using index info to reconstruct a base tree...
M	src/installer/installer.go
M	src/installer/installer_test.go
Falling back to patching base and 3-way merge...
Auto-merging src/installer/installer_test.go
CONFLICT (content): Merge conflict in src/installer/installer_test.go
Auto-merging src/installer/installer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 MGMT-16843: Ensure valid hostname during install
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-ocm-2.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@CrystalChun: #788 failed to apply on top of branch "release-ocm-2.8":

Applying: MGMT-16843: Ensure valid hostname during install
Using index info to reconstruct a base tree...
M	src/installer/installer.go
M	src/installer/installer_test.go
Falling back to patching base and 3-way merge...
Auto-merging src/installer/installer_test.go
CONFLICT (content): Merge conflict in src/installer/installer_test.go
Auto-merging src/installer/installer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 MGMT-16843: Ensure valid hostname during install
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-ocm-2.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@CrystalChun: new pull request created: #791

In response to this:

/cherry-pick release-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@CrystalChun: #788 failed to apply on top of branch "release-4.14":

Applying: MGMT-16843: Ensure valid hostname during install
Using index info to reconstruct a base tree...
M	src/installer/installer.go
M	src/installer/installer_test.go
Falling back to patching base and 3-way merge...
Auto-merging src/installer/installer_test.go
CONFLICT (content): Merge conflict in src/installer/installer_test.go
Auto-merging src/installer/installer.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 MGMT-16843: Ensure valid hostname during install
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.14

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-agent-installer-orchestrator-container-v4.16.0-202402222111.p0.g9f1f798.assembly.stream.el8 for distgit ose-agent-installer-orchestrator.
All builds following this will include this PR.

CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure
it is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
Cherry pick of PR openshift#788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
Cherry pick of PR openshift#788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
Cherry pick of PR openshift#788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure
it is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
Cherry pick of PR openshift#788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
CrystalChun added a commit to CrystalChun/assisted-installer that referenced this pull request Feb 23, 2024
Cherry pick of PR openshift#788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
openshift-merge-bot bot pushed a commit that referenced this pull request Feb 23, 2024
)

Cherry pick of PR #788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
openshift-merge-bot bot pushed a commit that referenced this pull request Feb 23, 2024
)

Cherry pick of PR #788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
openshift-merge-bot bot pushed a commit that referenced this pull request Mar 1, 2024
Cherry pick of PR #788
https://issues.redhat.com/browse/MGMT-16843
Some processes during install time depend on the hostname and an
invalid hostname (e.g. 'localhost', having capital letters, etc.)
that could cause the install to fail.

Extra validation is added when checking the hostname to ensure it
is valid. A random hostname will be assigned if the current
hostname is invalid.
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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants