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 last git commit hash to build flags #332

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Add last git commit hash to build flags #332

merged 1 commit into from
Nov 28, 2023

Conversation

thunderboltsid
Copy link
Contributor

@thunderboltsid thunderboltsid commented Nov 21, 2023

This ensures we have the git hash of the changes in our CI logs so we can correlate the code changes being executed.

How has this been tested?

$ make build
...
GIT_COMMIT_HASH=`git rev-parse HEAD` && \
	go build -ldflags "-X main.gitCommitHash=${GIT_COMMIT_HASH}" -o bin/manager main.go
$ ./bin/manager
{"level":"info","ts":"2023-11-28T12:31:44+05:30","logger":"setup","msg":"Initializing Nutanix Cluster API Infrastructure Provider","Git Hash":"d28682b71545d20be2810b0951bfafc0fe1f539a"}


$ make docker-build
GIT_COMMIT_HASH=`git rev-parse HEAD` && \
	KO_DOCKER_REPO=ko.local GOFLAGS="-ldflags=-X=main.gitCommitHash=${GIT_COMMIT_HASH}" /Users/sid.shukla/go/src/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/hack/tools/bin/ko-v0.11.2 build -B --platform=linux/amd64,linux/arm64,linux/arm -t latest -L .
...
$ docker run ko.local/cluster-api-provider-nutanix:87369c4ed070d9fd458328efbd3d583b05d07411141e37737fa46ae419dd35ef
{"level":"info","ts":"2023-11-28T07:03:14Z","logger":"setup","msg":"Initializing Nutanix Cluster API Infrastructure Provider","Git Hash":"d28682b71545d20be2810b0951bfafc0fe1f539a"}
...

# From the prow artefact manager logs
2023-11-28T07:38:42Z	INFO	setup	Initializing Nutanix Cluster API Infrastructure Provider	{"Git Hash": "2ec6b8ef047b3a8a99ba748a145d4810b62124fa"}

Copy link

codecov bot commented Nov 21, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c18f70a) 2.61% compared to head (d28682b) 2.61%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #332   +/-   ##
=====================================
  Coverage   2.61%   2.61%           
=====================================
  Files          4       4           
  Lines        995     995           
=====================================
  Hits          26      26           
  Misses       969     969           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@adiantum adiantum left a comment

Choose a reason for hiding this comment

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

LGTM

@adiantum
Copy link
Contributor

/approve
/lgtm
/meow

@nutanix-cn-prow-bot
Copy link

@adiantum: cat image

In response to this:

/approve
/lgtm
/meow

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.

@thunderboltsid
Copy link
Contributor Author

/retest

1 similar comment
@adiantum
Copy link
Contributor

/retest

@thunderboltsid thunderboltsid changed the title Add last git commit hash to build flags [WIP] Add last git commit hash to build flags Nov 21, 2023
@thunderboltsid
Copy link
Contributor Author

/retest

tuxtof
tuxtof previously approved these changes Nov 22, 2023
Copy link
Contributor

@tuxtof tuxtof left a comment

Choose a reason for hiding this comment

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

LGTM

@adiantum
Copy link
Contributor

/retest

@deepakm-ntnx
Copy link
Contributor

pls post the log output of the test showing the commit id for completeness in the description

This ensures we have the git hash of the changes in our CI logs
so we can correlate the code changes being executed.
Copy link

✅ None of your dependencies violate policy!

@thunderboltsid thunderboltsid changed the title [WIP] Add last git commit hash to build flags Add last git commit hash to build flags Nov 28, 2023
@thunderboltsid
Copy link
Contributor Author

/retest

@tuxtof
Copy link
Contributor

tuxtof commented Nov 28, 2023

/lgtm
/approve

Copy link
Contributor

@tuxtof tuxtof left a comment

Choose a reason for hiding this comment

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

/lgtm /approve

@nutanix-cn-prow-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adiantum, thunderboltsid, tuxtof

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 [adiantum,thunderboltsid,tuxtof]

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

@thunderboltsid thunderboltsid merged commit 3154cb0 into main Nov 28, 2023
10 checks passed
@thunderboltsid thunderboltsid deleted the git-hash branch November 28, 2023 10:09
thunderboltsid added a commit that referenced this pull request Apr 30, 2024
This ensures we have the git hash of the changes in our CI logs
so we can correlate the code changes being executed.
tuxtof added a commit that referenced this pull request May 2, 2024
…3.0 (#424)

* Fix credentials delete logic (#301)

- check if no delete attempt occured
 - check if no secret present in cluster
 - add integration test case in e2e suite
 - change Makefile test-e2e target to make able to run selected
   tests using GINKGO_FOCUS env variable
 - code grooming

* Bump docker/metadata-action from 4 to 5 (#317)

Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4 to 5.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Upgrade guide](https://github.com/docker/metadata-action/blob/master/UPGRADE.md)
- [Commits](docker/metadata-action@v4...v5)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Bump docker/login-action from 2 to 3 (#316)

Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@v2...v3)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Bump aquasecurity/trivy-action from 0.11.2 to 0.12.0 (#313)

Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.11.2 to 0.12.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.11.2...0.12.0)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Bump actions/checkout from 3 to 4 (#314)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* fix(manager): remove CPU limit and increase memory limit (#319)

* E2E for Cilium CNI without Kubeproxy (#310)

- add manifest scripts
 - change makefile

* Bump aquasecurity/trivy-action from 0.12.0 to 0.13.0 (#324)

Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.12.0 to 0.13.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.12.0...0.13.0)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Bump aquasecurity/trivy-action from 0.13.0 to 0.13.1 (#326)

Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.13.0...0.13.1)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* Bump aquasecurity/trivy-action from 0.13.1 to 0.14.0 (#327)

Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.13.1 to 0.14.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.13.1...0.14.0)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* fix CVE-2023-39325 (#329)

* update kube-vip to v0.6.3 (#320)

* Add codecov.yml to ensure adequate patch coverage (#328)

This sets the minimum patch coverage required for changes to repo to 75%.

* Add last git commit hash to build flags (#332)

This ensures we have the git hash of the changes in our CI logs
so we can correlate the code changes being executed.

* Cleanup for passing the linter (#336)

* Delete unused code from pkg/context

* Run gofumpt on the code

* Add lint fixes to test package

* Skip linting the conversion functions

The conversion functions are infinitely recursive and cause
linting errors.

* Remove unnecessary statement in lint target

* Revert file-scope licenses

* Bump aquasecurity/trivy-action from 0.14.0 to 0.15.0 (#337)

Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.14.0 to 0.15.0.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](aquasecurity/trivy-action@0.14.0...0.15.0)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Update controller-gen to v0.14.0

Peg go version in build job to go1.21
Update manifests
Run `make manifests`

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Ilya Alekseyev <ilya.alekseyev@nutanix.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Frederic M <43849398+fad3t@users.noreply.github.com>
Co-authored-by: Christophe Jauffret <christophe.jauffret@nutanix.com>
tuxtof pushed a commit that referenced this pull request May 2, 2024
This ensures we have the git hash of the changes in our CI logs
so we can correlate the code changes being executed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants