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

ci: autodetect cargo deb crates #101

Merged
merged 1 commit into from
May 17, 2024
Merged

Conversation

TheButlah
Copy link
Collaborator

@TheButlah TheButlah commented May 17, 2024

Lets us stop having to manually write out the list of binaries. Also will allow us to reuse this workflow in orb-internal, since it is no longer specific to this repo.

Also seeking opinions: Would it be better for me to keep the json parsing in jq, or do you want me to port it to native python?

@TheButlah TheButlah requested a review from andronat May 17, 2024 02:35
@TheButlah TheButlah force-pushed the thebutlah/autodetect-deb-crates branch from 0d6628e to 1ed5756 Compare May 17, 2024 02:35
@TheButlah TheButlah requested a review from dangirsh May 17, 2024 02:36
@TheButlah TheButlah force-pushed the thebutlah/autodetect-deb-crates branch from 1ed5756 to 728c8a5 Compare May 17, 2024 03:15
@TheButlah TheButlah enabled auto-merge (squash) May 17, 2024 04:25
Copy link
Member

@andronat andronat left a comment

Choose a reason for hiding this comment

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


targets = ["aarch64", "x86_64"]
def find_cargo_deb_crates():
jq_query = (
Copy link
Member

Choose a reason for hiding this comment

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

The alternative in Python would be (something along these lines):

    metadata = json.loads(cmd_output)
    workspace_members = set(metadata['workspace_members'])
    crates = [
        package['name']
        for package in metadata['packages']
        if package['id'] in workspace_members and 'deb' in package.get('metadata', {})
    ]

I personally find it more understandable. But I'll leave this to you.

Is jq always available btw? Because with pure python implementation you have the advantage of "peace of mind".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we ensure that jq is always available via the nix flake. But yes, I think I prefer the python approach more. Also, I know python more than I know jq. I'll open a new PR to port it.

)


def main():
parser = argparse.ArgumentParser(description="Builds rust artifacts for CI")
Copy link
Member

Choose a reason for hiding this comment

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

very nit for whenever (if) you have time: It would be amazing to have a description that our artifacts are actually debian packages, and also have the description declaring what are the assumptions under which we can build a debian.

@TheButlah TheButlah merged commit 49d1707 into main May 17, 2024
9 checks passed
@TheButlah TheButlah deleted the thebutlah/autodetect-deb-crates branch May 17, 2024 17:39
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.

2 participants