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

Test: CI Check for Changes in Examples Directory #3811

Closed

Conversation

Kalaiselvi84
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it:

Which issue(s) this PR fixes:

Closes #3794

Special notes for your reviewer:

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3811/head:pr_3811 && git checkout pr_3811
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.41.0-dev-23dd473-amd64

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 172e8b86-56ae-49ee-83e8-f9de874d6ea1

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3811/head:pr_3811 && git checkout pr_3811
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.41.0-dev-dabd840-amd64

@Kalaiselvi84 Kalaiselvi84 requested a review from zmerlynn May 9, 2024 21:40
@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3811/head:pr_3811 && git checkout pr_3811
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.41.0-dev-2ac7da5-amd64

@Kalaiselvi84
Copy link
Contributor Author

@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?

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3811/head:pr_3811 && git checkout pr_3811
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.41.0-dev-a7ffcf3-amd64

build/includes/sdk.mk Show resolved Hide resolved
@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); \
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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👍

Copy link
Contributor Author

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.

Copy link
Member

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 😨 😀

Copy link
Contributor Author

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.🙏

examples/allocation-endpoint/Makefile Outdated Show resolved Hide resolved
@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: b7b5f8a8-e02b-474b-9fbc-5ca91704a57d

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@markmandel
Copy link
Member

ERROR: failed to solve: failed to compute cache key: mount callback failed on /tmp/containerd-mount4055613205: link /tmp/containerd-mount4055613205/Windows/INF/basicrender.inf /tmp/containerd-mount4055613205/Windows/System32/DriverStore/FileRepository/basicrender.inf_amd64_efdc64af60c69a6d/basicrender.inf: no such file or directory
make: *** [Makefile:619: build-agones-sdk-image-windows-ltsc2019] Error 1

FYI - this isn't your thing failing, you'll want to update against main.

@agones-bot
Copy link
Collaborator

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:

  • git fetch https://github.com/googleforgames/agones.git pull/3811/head:pr_3811 && git checkout pr_3811
  • helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.41.0-dev-3e659f4-amd64

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.

Fail CI if a PR updates an example without modifying the version
3 participants