-
Notifications
You must be signed in to change notification settings - Fork 775
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
Test: CI Check for Changes in Examples Directory #3811
Test: CI Check for Changes in Examples Directory #3811
Conversation
Build Succeeded 👏 Build Id: 31e27266-aff2-4545-9ffa-182454abb55c The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Failed 😱 Build Id: 172e8b86-56ae-49ee-83e8-f9de874d6ea1 To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Build Succeeded 👏 Build Id: 5c87aacc-10ad-4c30-8cd9-4c30eef0f8f9 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
Build Succeeded 👏 Build Id: 8f3fc401-78e3-4437-a5e1-5aa65e256efa The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
@markmandel The script successfully detects changes in main.go, Dockerfile, Dockerfile.windows, go.mod, and go.sum within the examples directory on my local; however, it is not working as expected in CI. What could be the reason? |
Build Succeeded 👏 Build Id: c4a8f344-c58e-42a0-822a-7f5ffcc43903 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
@echo "Current directory: $$(pwd)" | ||
@echo "Checking for script changes in 'examples' subdirectories..." | ||
@cd $(CURDIR)/..; \ | ||
changed_dirs=$$(git diff --name-only HEAD | grep -E "examples/.*/(main\.go|Dockerfile|Dockerfile\.windows|go\.mod|go\.sum)$$" | xargs -n1 -r dirname | sort -u); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ow my head hurts 😄 can we get some descriptive comments in here to work out what this is all checking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I agree the script is confusing. Could you please share a better approach? I don't think this bash script will work well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed_dirs=$$(git diff --name-only HEAD | grep -E "examples/.*/(main.go|Dockerfile|Dockerfile.windows|go.mod|go.sum)$$" | xargs -n1 -r dirname | sort -u); \
This will find all the changed files under examples
subdirectories that match the given patterns (main.go, Dockerfile, Dockerfile.windows, go.mod, go.sum), after that it will extract the directories containing these files, remove duplicates, and store them in changed_dirs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I agree the script is confusing. Could you please share a better approach? I don't think this bash script will work well.
Go script? You've created some really nice ones in the past. Probably easier too!
https://pkg.go.dev/github.com/go-git/go-git/v5 looks like the dominant Go Git library.
On failure, you could log.Fatalf(...)
and CI would fail, since the exit code of the script would be non-zero.
This will find all the changed files under examples subdirectories that match the given patterns (main.go, Dockerfile, Dockerfile.windows, go.mod, go.sum)
Since each of the examples use different languages, I'm wondering if we want to exclude things we know we don't care about (*.md, *.yaml, OWNERS, .gitignore) rather than an include list - as the number of examples and language will expand over time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback. I will implement a Go script👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: The Go script implementation is in progress. Looks like bash script is simpler than the Go script. Will push the commit once completed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like bash script is simpler than the Go script
I'm hoping the Go script is easier to understand though 😄 grep -oP '^[^#]*version\s*:=\s*\K[^ ]+'
- that scared me 😨 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have implemented a Go script but ignoring comments from the files is the challenging part for me. https://gist.github.com/Kalaiselvi84/cadc597d7fa2c229ecf2a992ddbd4b01
I think it is infeasible for me, giving up. I will close this PR. Thanks for your help and support.🙏
Build Failed 😱 Build Id: b7b5f8a8-e02b-474b-9fbc-5ca91704a57d To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
FYI - this isn't your thing failing, you'll want to update against main. |
Build Succeeded 👏 Build Id: 812cb7b3-53c6-4c50-82db-5c43b94a80ac The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version:
|
What type of PR is this?
What this PR does / Why we need it:
Which issue(s) this PR fixes:
Closes #3794
Special notes for your reviewer: