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

Use project Go version for generating website content #542

Merged
merged 1 commit into from
May 15, 2023
Merged

Use project Go version for generating website content #542

merged 1 commit into from
May 15, 2023

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented May 12, 2023

The project documentation is published on a companion website. A GitHub Actions workflow is used to automatically update the website whenever any relevant file is changed in the repository. This website includes content generated from the project's Go code.

Previously, the default version of Go from the GitHub Actions runner machine was used for generating the documentation content. A recent update of this default Go version from 1.17 to 1.20 (actions/runner-images#7276) caused the generation process to fail:

task: [go:rule-docs] ./ruledocsgen ../docs/rules
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xa29866]

goroutine 1 [running]:
debug/elf.(*Section).ReadAt(0xc0003a4000?, {0xc000376000?, 0x24?, 0x23?}, 0x23?)
	<autogenerated>:1 +0x26
archive/zip.readDirectoryEnd({0xe9d780, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:581 +0xf5
archive/zip.(*Reader).init(0xc00030bc70, {0xe9d780?, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:124 +0x5c
archive/zip.NewReader({0xe9d780, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:103 +0x5e
github.com/daaku/go%2ezipexe.zipExeReaderElf({0xea05a0?, 0xc000120840}, 0x1846986)
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:128 +0x8b
github.com/daaku/go%2ezipexe.NewReader({0xea05a0, 0xc000120840}, 0x0?)
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:48 +0x98
github.com/daaku/go%2ezipexe.OpenCloser({0xc0001543c0?, 0xc000147390?})
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:30 +0x57
github.com/cmaglie/go%2erice.init.0()
	/home/runner/go/pkg/mod/github.com/cmaglie/go.rice@v1.0.3/appended.go:42 +0x65

This error, and the general fragility that comes from the lack of control over the Go version, is avoided by configuring the workflow to use the specific version of Go that is used for development and validation of the project.


Demonstration in my fork of a successful run of the updated "Deploy Website" workflow:

https://github.com/per1234/arduino-lint/actions/runs/4955499040/jobs/8864951607#step:7:23

Demonstration run of the updated "Check Markdown" workflow:

https://github.com/arduino/arduino-lint/actions/runs/4955538345/jobs/8865023358?pr=542#step:5:238

This run still fails, but the cause of the failure is now legitimate (broken links) rather than a spurious failure caused by the generation process erroring.

@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project labels May 12, 2023
@per1234 per1234 self-assigned this May 12, 2023
The project documentation is published on a companion website. A GitHub Actions workflow is used to automatically update
the website whenever any relevant file is changed in the repository. This website includes content generated from the
project's Go code.

Previously, the default version of Go from the GitHub Actions runner machine was used for generating the documentation
content. A recent update of this default Go version from 1.17 to 1.20 caused the generation process to fail:

```
task: [go:rule-docs] ./ruledocsgen ../docs/rules
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xa29866]

goroutine 1 [running]:
debug/elf.(*Section).ReadAt(0xc0003a4000?, {0xc000376000?, 0x24?, 0x23?}, 0x23?)
	<autogenerated>:1 +0x26
archive/zip.readDirectoryEnd({0xe9d780, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:581 +0xf5
archive/zip.(*Reader).init(0xc00030bc70, {0xe9d780?, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:124 +0x5c
archive/zip.NewReader({0xe9d780, 0xc000328b80}, 0x210)
	/opt/hostedtoolcache/go/1.20.4/x64/src/archive/zip/reader.go:103 +0x5e
github.com/daaku/go%2ezipexe.zipExeReaderElf({0xea05a0?, 0xc000120840}, 0x1846986)
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:128 +0x8b
github.com/daaku/go%2ezipexe.NewReader({0xea05a0, 0xc000120840}, 0x0?)
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:48 +0x98
github.com/daaku/go%2ezipexe.OpenCloser({0xc0001543c0?, 0xc000147390?})
	/home/runner/go/pkg/mod/github.com/daaku/go.zipexe@v1.0.1/zipexe.go:30 +0x57
github.com/cmaglie/go%2erice.init.0()
	/home/runner/go/pkg/mod/github.com/cmaglie/go.rice@v1.0.3/appended.go:42 +0x65
```

This error, and the general fragility that comes from the lack of control over the Go version, is avoided by configuring
the workflow to use the specific version of Go that is used for development and validation of the project.
Copy link
Contributor

@MatteoPologruto MatteoPologruto left a comment

Choose a reason for hiding this comment

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

Thanks Per!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants