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-14633: Include manifest information in the log download #5777

Merged
merged 1 commit into from Dec 14, 2023

Conversation

paul-maidment
Copy link
Contributor

@paul-maidment paul-maidment commented Dec 5, 2023

When the user downloads the logs for the cluster, we would like to include any cluster manifets in these logs so that they may be examined.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
    Manually set up a cluster with manifests and then triggered a download of the manifests, a CURL request similar to
    curl -X GET $SERVICE_URI/api/assisted-install/v2/clusters/61e94f28-bbd7-4719-b555-d7d7f9d5cc60/logs?logs_type=all --output logs.tar.gz was used.
    I also checked in the UI to ensure that the download looks appropriate.
  • [] No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 5, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 5, 2023

@paul-maidment: This pull request references MGMT-14633 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 task to target the "4.15.0" version, but no target version was set.

In response to this:

When downloading the logs it is desired that the manifests of the cluster are also included in the download so that these may be examined.

This PR introduces that functionality.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
    Manually set up a cluster with manifests and then triggered a download of the manifests, a CURL request similar to
    curl -X GET $SERVICE_URI/api/assisted-install/v2/clusters/61e94f28-bbd7-4719-b555-d7d7f9d5cc60/logs?logs_type=all --output logs.tar.gz was used.
    I also checked in the UI to ensure that the download looks appropriate.
  • [] No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

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-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 5, 2023
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 5, 2023
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #5777 (68a20ca) into master (6ef1281) will decrease coverage by 0.04%.
Report is 1 commits behind head on master.
The diff coverage is 7.40%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5777      +/-   ##
==========================================
- Coverage   68.07%   68.03%   -0.04%     
==========================================
  Files         235      235              
  Lines       34398    34427      +29     
==========================================
+ Hits        23416    23422       +6     
- Misses       8921     8945      +24     
+ Partials     2061     2060       -1     
Files Coverage Δ
internal/cluster/cluster.go 65.45% <7.40%> (-1.47%) ⬇️

... and 3 files with indirect coverage changes

path := filepath.Join(manifestEntry.Folder, manifestEntry.FileName)
objectName := filepath.Join(string(*c.ID), constants.ManifestFolder, path)
exists, _ := objectHandler.DoesObjectExist(ctx, objectName)
if exists {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a guard here instead of indenting everything else?

For example:

if !exists {
  continue
}
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good suggestion..taken!

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 you want !exists, right?

@paul-maidment paul-maidment force-pushed the MGMT-14633 branch 2 times, most recently from dd6774a to 0a57142 Compare December 7, 2023 10:09
path := filepath.Join(manifestEntry.Folder, manifestEntry.FileName)
objectName := filepath.Join(string(*c.ID), constants.ManifestFolder, path)
exists, _ := objectHandler.DoesObjectExist(ctx, objectName)
if exists {
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 you want !exists, right?

manifest_prefix = "user-supplied"
}
fileName := fmt.Sprintf("%s/logs/manifest_%s_%s/%s", c.ID, manifest_prefix, manifestEntry.Folder, manifestEntry.FileName)
_ = m.uploadDataAsFile(ctx, log, string(fileContent), fileName, objectHandler)
Copy link
Member

Choose a reason for hiding this comment

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

We should probably at least log here if this errors, right?

@paul-maidment
Copy link
Contributor Author

/retest

2 similar comments
@paul-maidment
Copy link
Contributor Author

/retest

@paul-maidment
Copy link
Contributor Author

/retest

When the user downloads the logs for the cluster, we would like to include any cluster manifets in these logs so that they may be examined.
@paul-maidment
Copy link
Contributor Author

/retest

@paul-maidment paul-maidment changed the title MGMT-14633: WIP include manifest information in the log download MGMT-14633: Include manifest information in the log download Dec 14, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 14, 2023

@paul-maidment: This pull request references MGMT-14633 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 task to target the "4.16.0" version, but no target version was set.

In response to this:

When the user downloads the logs for the cluster, we would like to include any cluster manifets in these logs so that they may be examined.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested)
    Manually set up a cluster with manifests and then triggered a download of the manifests, a CURL request similar to
    curl -X GET $SERVICE_URI/api/assisted-install/v2/clusters/61e94f28-bbd7-4719-b555-d7d7f9d5cc60/logs?logs_type=all --output logs.tar.gz was used.
    I also checked in the UI to ensure that the download looks appropriate.
  • [] No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

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-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2023
Copy link

openshift-ci bot commented Dec 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carbonin, paul-maidment

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:
  • OWNERS [carbonin,paul-maidment]

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

Copy link

openshift-ci bot commented Dec 14, 2023

@paul-maidment: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 0b779ca into openshift:master Dec 14, 2023
14 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

This PR has been included in build ose-agent-installer-api-server-container-v4.16.0-202312150050.p0.g0b779ca.assembly.stream for distgit ose-agent-installer-api-server.
All builds following this will include this PR.

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

4 participants