Skip to content

[skip changelog] Fix bugs related to protobuf archive generation #1965

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

Merged
merged 3 commits into from
Nov 7, 2022
Merged

[skip changelog] Fix bugs related to protobuf archive generation #1965

merged 3 commits into from
Nov 7, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 6, 2022

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • [N/A] Tests for the changes have been added (for bug fixes / features)
  • [N/A] Docs have been added / updated (for bug fixes / features)
  • [N/A] UPGRADING.md has been updated with a migration guide (for breaking changes)

What kind of change does this PR introduce?

Infrastructure fix

What is the current behavior?

An additional operation was recently added to the GitHub Actions workflows that produce builds of Arduino CLI: the generation of protocol buffer archive files to publish
along with the builds (#1931).

Some bugs were introduced at that time which caused the nightly build and release workflows to fail.

What is the new behavior?

Fix all the bugs introduced by the previous protocol buffer archive generation work:

  • Add missing checkout steps to build publishing workflow jobs
  • Don't error protobuf archive task if distribution folder already exists
  • Set correct version for nightly build protobuf archive filename

Does this PR introduce a breaking change, and is titled accordingly?

No breaking change.

Other information

…low jobs

GitHub Actions workflows are used to automatically generate nightly builds and production releases of the project.

A workflow job is dedicated to the publishing of the build. Previously, this job only needed to download the workflow
artifact containing the build filess created by the previous job, generate a checksum file, and upload the builds to
Arduino's server. None of these operations had any need for the contents of the repository, so a checkout step was not
added to the job.

An additional operation was recently added to the publishing job: the generation of archives containing the protocol
buffer files to publish along with the builds. This new operation does require the contents of the repository. A
checkout step was not added to the job at that time, which caused the protocol buffer generation step and the publishing
job to fail:

task: No Taskfile found in "/home/runner/work/arduino-cli/arduino-cli". Use "task --init" to create a new one

The problem is resolved by adding a step that uses the `actions/checkout` GitHub Actions action to checkout the Arduino
CLI repository into the runner machine to make it available for use in that job.
…lder already exists

The `protoc:collect` task generates a ZIP archive of the project's protocol buffer files for inclusion with the
published builds.

In the case of the nightly and release build workflows, the distribution folder the archive is generated into was
already created by the build operations in the preceeding workflow job. Previously, the task (and thus entire build
workflow) would fail in this case when attempting to create the folder that already exists:

mkdir: cannot create directory ‘../dist’: File exists

In addition to the obvious purpose, the `--parents` flag of the `mkdir` command also has the following additional
effect:

> no error if existing

So adding this flag to the command resolves the spurious failure. It will create the folder when necessary, but simply
carry on with the rest of the task when it does exist.
…ve filename

Different version identifiers are used for the build archive filenames depending on the type of build:

Local: git-snapshot
Tester: test-<reference>-git-snapshot
Nightly: nightly-<date>
Production: <tag>

The use of a nightly build version format is specified by setting the `NIGHTLY` environment variable to `true` in the
GitHub Actions workflow.

An additional step was recently added to the build workflows: the generation of archives of protocol buffer files to
publish along with the builds. The setting of the `NIGHTLY` environment variable in that step was neglected in the
nightly build workflow, which caused the protocol buffer archive file to be named with the local build version
identifier instead of the nightly build version identifier. This also resulted in the protocol buffer archive file not
being added to the checksums file.
@per1234 per1234 added topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface labels Nov 6, 2022
@per1234 per1234 self-assigned this Nov 6, 2022
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!

@per1234 per1234 merged commit e6e5dd6 into arduino:master Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: gRPC Related to the gRPC interface 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