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

Update lifecycle status #144

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

nicholasSUSE
Copy link
Collaborator

@nicholasSUSE nicholasSUSE commented Jul 26, 2024

Issue:

rancher/ecm-distro-tools#445

Solution:

Preparing charts-build-scripts command lifecycle-status to be migrated into automation inside: ecm-distro-tools

Changing main behavior of lifecycle-status from creating and cloning a temporary directory structure for rancher/charts repository to executing all actions in the current charts repository and persisting the results to parsable state.json file that can be loaded by different commands.

Result example:

{
  "state_file": "/home/nick/WORK/SOFTWARE/go/src/github.com/release-work/charts/state.json",
  "in_lifecycle_current_branch": {
    "elemental": [
      {
        "Version": "104.1.1+up1.5.4"
      },
      {
        "Version": "104.1.0+up1.5.3"
      }
    ],
    "elemental-crd": [
      {
        "Version": "104.1.1+up1.5.4"
      },
      {
        "Version": "104.1.0+up1.5.3"
      }
    ]
  },
  "out_lifecycle_current_branch": {
    "prometheus-federator": [
      {
        "Version": "3.0.0+up0.3.3"
      },
      {
        "Version": "2.1.0+up0.3.0"
      }
    ]
  },
  "released_in_lifecycle": {
    "elemental": [
      {
        "Version": "104.1.1+up1.5.4"
      },
      {
        "Version": "104.1.0+up1.5.3"
      }
    ],
    "elemental-crd": [
      {
        "Version": "104.1.1+up1.5.4"
      },
      {
        "Version": "104.1.0+up1.5.3"
      }
    ]
  },
  "not_released_out_lifecycle": {
    "fleet": [
      {
        "Version": "100.2.3+up0.5.3"
      },
      {
        "Version": "100.2.0+up0.5.1"
      },
      {
        "Version": "100.1.1+up0.4.1"
      },
      {
        "Version": "100.1.0+up0.4.0"
      }
    ]
  },
  "not_released_in_lifecycle": {},
  "released_out_lifecycle": {
    "rancher-backup": [
      {
        "Version": "3.0.0"
      },
      {
        "Version": "2.1.5"
      },
      {
        "Version": "2.1.4"
      }
    ]
  },
  "to_be_released": {},
  "to_be_forward_ported": {}
}

…charts repository.

Now it executes all operations in the current charts repository.
Removing the legacy code.
Updating git methods.
@nicholasSUSE nicholasSUSE requested a review from a team as a code owner July 26, 2024 19:09
@@ -0,0 +1,136 @@
package lifecycle

Choose a reason for hiding this comment

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

Remove all logging from library code please.

}

file, _ := os.Open(s.StateFile)
// Read the file content

Choose a reason for hiding this comment

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

Move this comment above the operation

// initState will create a new state file and save the state to it
func (s *Status) initState() error {

err := s.createStateFile()

Choose a reason for hiding this comment

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

Make all calls that do a single error check inline.

// Marshal the Project struct into JSON
data, err := json.MarshalIndent(s, "", " ")
if err != nil {
err = fmt.Errorf("error marshalling project to JSON: %w", err)
Copy link

@briandowns briandowns Jul 26, 2024

Choose a reason for hiding this comment

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

Are all of the errors here lacking enough context to warrant having more info added? Usually not necessary and not a standard for the lang.

@nicholasSUSE nicholasSUSE requested a review from briandowns July 29, 2024 16:36
@nicholasSUSE
Copy link
Collaborator Author

@briandowns all fixes implemented.

@nicholasSUSE nicholasSUSE merged commit 3525298 into rancher:master Jul 30, 2024
3 checks passed
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.

3 participants