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

Add codesign utility function #284

Merged
merged 1 commit into from
Apr 14, 2024
Merged

Add codesign utility function #284

merged 1 commit into from
Apr 14, 2024

Conversation

gitperr
Copy link
Contributor

@gitperr gitperr commented Feb 15, 2024

Calls on rcodesign to code sign a target binary.

TODO:

  • Add tests (no good way of doing this, rcodesign verify does not work very well with this warning: (the verify command is known to be buggy and gives misleading results; we highly recommend using Apple's tooling until this message is removed)
  • Other, based on feedback

@gitperr gitperr changed the title Draft:Add codesign utility function Add codesign utility function Feb 15, 2024
@gitperr gitperr marked this pull request as draft February 15, 2024 19:49
@gitperr
Copy link
Contributor Author

gitperr commented Feb 17, 2024

@SuperQ wanna take a look?

@gitperr gitperr marked this pull request as ready for review February 17, 2024 19:21
Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

Minor nit, otherwise LGTM.

We're also going to need to plumb this into our CI templates so that it's done automatically.

cmd/codesign.go Outdated Show resolved Hide resolved
@gitperr
Copy link
Contributor Author

gitperr commented Feb 18, 2024

Squashed, will make changes to prometheus/node_exporter#2916 as well to accompany this.

gitperr added a commit to gitperr/node_exporter that referenced this pull request Feb 18, 2024
The functionality being replaced here is going to be
built into `promu` with prometheus/promu#284
So pipelines should use it instead.
Signed-off-by: Alper Polat <[email protected]>
@gitperr gitperr force-pushed the master branch 2 times, most recently from 662a10b to 4fb85da Compare February 18, 2024 14:09
@gitperr
Copy link
Contributor Author

gitperr commented Feb 18, 2024

Updated README as well now. And squashed again. Should be good to go, please take another look.

This should be merged before prometheus/node_exporter#2916 to make pipelines start working properly with promu codesign

Copy link
Member

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Alper Polat <[email protected]>

Add rcodesign as a new utility function

Signed-off-by: Alper Polat <[email protected]>

Update year to 2024

Signed-off-by: Alper Polat <[email protected]>

Update README

Signed-off-by: Alper Polat <[email protected]>

Indicate that the binary to be signed is darwin binary

Signed-off-by: Alper Polat <[email protected]>

Gofumpt to get rid of linter warnings

Signed-off-by: Alper Polat <[email protected]>
@gitperr
Copy link
Contributor Author

gitperr commented Mar 19, 2024

@roidelapluie does this PR look good?

@gitperr
Copy link
Contributor Author

gitperr commented Apr 14, 2024

Is there anyone else we can ask review from? If roidelapluie is busy, maybe someone else could take a look?

@SuperQ SuperQ merged commit c9568e4 into prometheus:master Apr 14, 2024
3 checks passed
SuperQ added a commit that referenced this pull request Apr 14, 2024
* [FEATURE] Add codesign utility function #284

Signed-off-by: SuperQ <[email protected]>
@SuperQ SuperQ mentioned this pull request Apr 14, 2024
SuperQ added a commit that referenced this pull request Apr 14, 2024
* [FEATURE] Add codesign utility function #284

Signed-off-by: SuperQ <[email protected]>
SuperQ added a commit that referenced this pull request Apr 19, 2024
* [FEATURE] Add codesign utility function #284

Signed-off-by: SuperQ <[email protected]>
gitperr added a commit to gitperr/node_exporter that referenced this pull request Apr 30, 2024
Signed-off-by: Alper Polat <[email protected]>

Bump golang-builder version (prometheus#2908)

Signed-off-by: Alper Polat <[email protected]>

exec_bsd: Fix labels for vm.stats.sys.v_syscall sysctl (prometheus#2895)

Signed-off-by: David O'Rourke <[email protected]>

chore:remove constant from function (prometheus#2884)

Signed-off-by: tyltr <[email protected]>

build(deps): bump github.com/prometheus/common from 0.45.0 to 0.46.0 (prometheus#2910)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.45.0 to 0.46.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.45.0...v0.46.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

build(deps): bump github.com/jsimonetti/rtnetlink from 1.4.0 to 1.4.1 (prometheus#2909)

Bumps [github.com/jsimonetti/rtnetlink](https://github.com/jsimonetti/rtnetlink) from 1.4.0 to 1.4.1.
- [Release notes](https://github.com/jsimonetti/rtnetlink/releases)
- [Commits](jsimonetti/rtnetlink@v1.4.0...v1.4.1)

---
updated-dependencies:
- dependency-name: github.com/jsimonetti/rtnetlink
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

fix hwmon nil ptr (prometheus#2873)

* fix hwmon nil ptr

syslink maybe lost in some cases.

---------

Signed-off-by: TaoGe <[email protected]>

Fix hwmon error capture (prometheus#2915)

Fix golangci-lint "ineffectual assignment" by correctly capturing any
errors within the hwmon gathering loop.

Signed-off-by: Ben Kochie <[email protected]>

Attempt to sign the node exporter darwin build

This should hopefully fix the SIGKILL issue on OSX machines.
e.g. in: prometheus#2539

Signed-off-by: Alper Polat <[email protected]>

Change the docker flags to correct ones

Signed-off-by: Alper Polat <[email protected]>

Fix errors in running the rcodesign from golang-builder

Signed-off-by: Alper Polat <[email protected]>

Use pwd instead

Readlink does not work to get the proper path, pwd might do it.
As promu seems to be copying the binaries based on working directory.

Signed-off-by: Alper Polat <[email protected]>

Try to run at the same job to see if it helps

So far I am unable to find the binary's location with
either pwd or readlink. I'm suspecting that the binary is
not on this specific host that is running the rcodesign.

Signed-off-by: Alper Polat <[email protected]>

Try to debug what files are in the current working directory

Signed-off-by: Alper Polat <[email protected]>

Print working directory as well

Signed-off-by: Alper Polat <[email protected]>

Add quote wrapping

Signed-off-by: Alper Polat <[email protected]>

Try to debug more

Signed-off-by: Alper Polat <[email protected]>

Nothing seems to be in .build directory here

Signed-off-by: Alper Polat <[email protected]>

Remove some of debug commands

Seems like the build does not get produced because of the
CircleCI node index that gets passed into `--parallelism-thread`.
Signed-off-by: Alper Polat <[email protected]>

Add a separate sign stage for code signing

Separate stage might be useful so that we have all of
the builds that end up in `.build` here, and sign the one(s)
that we want. First one being implemented here is darwin-arm64.

Signed-off-by: Alper Polat <[email protected]>

Run only if darwin-arm64 was built

Earlier I tried to add a separate stage for signing,
but seems like that was a bad idea because the pipeline
file has to exist in `master` for that so we can run
the tests properly. Checking with if might be one of the
simpler and better ideas...

Signed-off-by: Alper Polat <[email protected]>

Add forgotten quote

Fixing basic syntax error

Signed-off-by: Alper Polat <[email protected]>

Update common Prometheus files (prometheus#2917)

Signed-off-by: prombot <[email protected]>

Use promu to code sign

The functionality being replaced here is going to be
built into `promu` with prometheus/promu#284
So pipelines should use it instead.
Signed-off-by: Alper Polat <[email protected]>

Use Promu 0.17.0

Signed-off-by: Alper Polat <[email protected]>

Introduce one error first

We want to re-trigger the pipeline. But, the circleCI interface
does not allow re-runs. So, going to introduce a dummy error,
take it back and re-trigger the pipeline like that.
Signed-off-by: Alper Polat <[email protected]>

Set version to correct one

Signed-off-by: Alper Polat <[email protected]>
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