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

[WIP] Support for experimental plugins in packaging #332

Closed
wants to merge 1 commit into from
Closed
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: 2 additions & 0 deletions plugins/.common
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

DESTDIR=${DESTDIR:-}
PREFIX=${PREFIX:-/usr/local}
EXPERIMENTAL_PLUGIN=${EXPERIMENTAL_PLUGIN:-}

add_github_ssh_host() {
# You're not able to clone from github unless you add to known_hosts
Expand All @@ -12,6 +13,7 @@ add_github_ssh_host() {
}

install_binary() {
[ -n "${EXPERIMENTAL_PLUGIN}" ] && PREFIX=${PREFIX}-experimental
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be preferable to do something like this:

Suggested change
[ -n "${EXPERIMENTAL_PLUGIN}" ] && PREFIX=${PREFIX}-experimental
local install_prefix="${PREFIX}"
if [ -n "${EXPERIMENTAL_PLUGIN}" ]; then
install_prefix="${PREFIX}-experimental"
fi

Then change line 19 from ${PREFIX} to ${install_prefix} that way we can avoid changing global variables

for binary in "$@"; do
mkdir -p "${DESTDIR}${PREFIX}"
install -p -m 755 "${binary}" "${DESTDIR}${PREFIX}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
install -p -m 755 "${binary}" "${DESTDIR}${PREFIX}"
install -p -m 755 "${binary}" "${DESTDIR}${install_prefix}"

Expand Down
1 change: 1 addition & 0 deletions plugins/app.installer
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GOPATH=$(go env GOPATH)
REPO=https://github.com/docker/app.git
COMMIT=v0.8.0-beta2
DEST=${GOPATH}/src/github.com/docker/app
export EXPERIMENTAL_PLUGIN=1

build() {
if [ ! -d "${DEST}" ]; then
Expand Down
7 changes: 5 additions & 2 deletions plugins/buildx.installer
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GOPATH=$(go env GOPATH)
REPO=https://${PKG}.git
COMMIT=master
DEST=${GOPATH}/src/${PKG}
export EXPERIMENTAL_PLUGIN=1

build() {
if [ ! -d "${DEST}" ]; then
Expand All @@ -18,8 +19,10 @@ build() {
git fetch --all
git checkout -q "${COMMIT}"
local LDFLAGS
# TODO: unmark `-tp` when no longer a technical preview
LDFLAGS="-X ${PKG}/version.Version=$(git describe --match 'v[0-9]*' --always --tags)-tp -X ${PKG}/version.Revision=$(git rev-parse HEAD) -X ${PKG}/version.Package=${PKG}"
local VERSION
Copy link
Contributor

Choose a reason for hiding this comment

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

Might also be useful to name this something different as to avoid overwriting the global VERSION we use for the dockerd/docker-cli builds.

VERSION=$(git describe --match 'v[0-9]*' --always --tags)
test -n "${EXPERIMENTAL_PLUGIN}" && VERSION=${VERSION}-tp
seemethere marked this conversation as resolved.
Show resolved Hide resolved
LDFLAGS="-X ${PKG}/version.Version=${VERSION} -X ${PKG}/version.Revision=$(git rev-parse HEAD) -X ${PKG}/version.Package=${PKG}"
set -x
go build -o bin/docker-buildx -ldflags "${LDFLAGS}" ./cmd/buildx
)
Expand Down