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

fix(ping/rust): Don't set PR ref for master build #79

Merged
merged 2 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ping/_compositions/rust-cross-versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

[groups.build_config.build_args]
BINARY_NAME = '{{ .BinaryName }}'
GIT_REF = '{{ $.Env.GitReference }}'
GIT_REF = "master"
{{ end }}

{{ if $.Env.GitReference }}
Expand Down
2 changes: 1 addition & 1 deletion ping/rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ ARG GIT_TARGET=""
RUN if [ ! -z "${GIT_TARGET}" ]; then sed -i "s,^git.*,git = \"https://${GIT_TARGET}\"," ./plan/Cargo.toml; fi

ARG GIT_REF=""
RUN if [ ! -z "${GIT_REF}" ]; then sed -i "s/^rev.*/rev = \"${GIT_REF}\"/" ./plan/Cargo.toml; fi
RUN if [ ! -z "${GIT_REF}" ]; then sed -i "s/^rev.*/branch = \"${GIT_REF}\"/" ./plan/Cargo.toml; fi
Copy link
Member Author

Choose a reason for hiding this comment

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

This change breaks the custom build, as that one uses a rev and not a branch 🤦‍♂️ silly me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I had the same in the back of my head, but the following fails for me:

➜  rust git:(master-ref) ✗ cargo check
    Updating git repository `https://github.com/libp2p/rust-libp2p`
error: failed to get `libp2p` as a dependency of package `testplan v0.1.0 (/home/mxinden/code/github.com/libp2p/test-plans/ping/rust)`

Caused by:
  failed to load source for dependency `libp2p`

Caused by:
  Unable to update https://github.com/libp2p/rust-libp2p?rev=master

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

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

You might need to prefix with refs/:

  • refs/remotes/origin/master
  • refs/heads/master

Copy link
Contributor

Choose a reason for hiding this comment

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

rev should accept a branch name actually: doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories

This is talking about named references being supported so I think one of those two should work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Wonderful. Thanks @thomaseizinger. refs/heads/master resolves to the current master commit (libp2p/rust-libp2p@babacc5). For some reason refs/removes/origin/master points to libp2p/rust-libp2p@b99a213, a previous commit on master.

I created #81 adopting the former. Please take a look.


# Build the requested binary: Cargo will update lockfile on changed manifest (i.e. if one of the above `sed`s patched it).
ARG BINARY_NAME
Expand Down