Skip to content

Instantly share code, notes, and snippets.

@akutz
Last active May 10, 2017 22:28
Show Gist options
  • Save akutz/15e7d6610196fb885a015646824112ad to your computer and use it in GitHub Desktop.
Save akutz/15e7d6610196fb885a015646824112ad to your computer and use it in GitHub Desktop.
build.sh

REX-Ray's Build Command

The new build.sh command (PR #864) simplifies building REX-Ray from source. The command supports two types of build platforms: make and Docker.

Build with make

The make command is the traditional tool used to build software. To build REX-Ray with make using the build.sh command, simply use the -b flag to specify the make builder:

$ ./build.sh -b make

Build with Docker

While the make command is the preferred approach for engineers, it can be daunting for newcomers. Docker solves this issue by providing a simplified, deterministic, development platform for nascent coders.

Build REX-Ray from Local Sources with Docker

The following command will build REX-Ray from the local source code using Docker:

$ ./build.sh

Build REX-Ray from a Tagged Release with Docker

The following command will build REX-Ray from the v0.6.0 tag using the primary REX-Ray repository https://github.com/codedellemc/rexray.

$ ./build.sh -r v0.6.1

Build REX-Ray from a Forked Branch with Docker

The following command will build REX-Ray from the feature/build.sh branch using the REX-Ray fork at https://github.com/akutz/rexray.

$ ./build.sh -u akutz -r feature/build.sh

Build REX-Ray with Docker using Local libStorage Sources

The following command will build REX-Ray from the local sources and replace the libStorage sources referenced in REX-Ray's glide.yaml file with the local libStorage sources at $GOPATH/src/github.com/codedellemc/libstorage.

$ ./build.sh -l

Build REX-Ray with Docker using Remote libStorage Sources

The following command will build REX-Ray from the local sources and replace the libStorage sources referenced in REX-Ray's glide.yaml file with the libStorage sources tagged as v0.5.1 using the primary libStorage repository https://github.com/codedellemc/libStorage.

$ ./build.sh -2 v0.5.1

Build REX-Ray with Docker using a Forked libStorage Branch

The following command will build REX-Ray from the local sources and replace the libStorage sources referenced in REX-Ray's glide.yaml file with the libStorage sources from the feature/driver-plugins branch on the fork https://github.com/akutz/libStorage.

$ ./build.sh -1 akutz -2 feature/driver-plugins

Build REX-Ray from a Remote Commit ID with Docker using a Remote libStorage Commit ID

The following command will build REX-Ray from remote commit ID 3ed90f349882fbe4f035b697aca2753d8db89027 and replace the libStorage sources referenced in REX-Ray's glide.yaml file with the libStorage sources at commit ID e24481c7e5ff9a4da4ead1313b995501f341b21f on the primary libStorage repository.

$ ./build.sh -u https://github.com/codedellemc/rexray -r 3ed90f349882fbe4f035b697aca2753d8db89027 -1 https://github.com/codedellemc/libstorage -2 e24481c7e5ff9a4da4ead1313b995501f341b21f

Usage

The following help can be displayed at any time using $ ./build.sh -?.

usage: build.sh [-b builder] [-x] [-t type] [-d drivers]
                [-u rr_uri] [-r rr_ref]
                [-l]
                [-1 ls_uri] [-2 ls_ref]
                [FILE]

       -b builder       Optional. The builder used to build REX-Ray. Possible
                        values include docker and make. The default value, if
                        installed and running, is docker. If Docker is not
                        installed or the current user cannot access it then
                        make is used.

                        If docker is *explicitly* specified but not installed
                        or inaccessible, this program will *not* switch to
                        make, but instead exit with an error.

       -x               Optional. This flag is only applicable to the make
                        build runner. If set, this flag prevents make from
                        performing a clean ahead of the build. Therefore
                        this flag results in the preservation of e-X-isting
                        files.

                        This flag sets '-b make'.

       -t type          Optional. The type of REX-Ray binary to create.
                        Possible values include: agent, client, and controller
                        The default value is the same as omitting this flag and
                        argument altogether and will create a binary that
                        includes the agent, client, and controller.

       -d drivers       Optional. One or more drivers to include in the binary.
                        Specify multiple drivers as a quoted, space-delimited
                        list.

                        Drivers are only included in standard and controller
                        binaries. Please see the -t type flag for more
                        information on binary types.

       -u uri           Optional. The URI to a REX-Ray, git repository . This
                        flag is only valid for the docker builder. Specifying
                        a repository will use its sources (specified by the
                        associated -r ref flag) instead of the local sources.

       -r ref           Optional. The git references to use when specifying the
                        -u uri flag. This value can be a commit ID, tag, or
                        branch name. The default value is master.

                        This flag sets '-b docker'.

                        If -r is set but -u is not, -u will be set to
                        to libStorage's primary repository URI.

       -l               Optional. A flag indicating to use the local libStorage
                        sources instead of the libStorage version specified in
                        REX-Ray's glide.yaml file.

                        This flag sets '-b docker' and cannot be used with the
                        -1 or -2 flags.

       -1 uri           Optional. The URI to a libStorage, git repository. This
                        flag is only valid for the docker builder. Specifying
                        a repository will use its sources (specified by the
                        associated -2 ref flag) instead of the libStorage
                        version specified in REX-Ray's glide.yaml file.

                        This flag sets '-b docker' and cannot be used with the
                        -l flag.

       -2 ref           Optional. The git references to use when specifying the
                        -1 uri flag. This value can be a commit ID, tag, or
                        branch name. The default value is master.

                        This flag sets '-b docker' and cannot be used with the
                        -l flag.

                        If -2 is set but -1 is not, -1 will be set to
                        to libStorage's primary repository URI.

       FILE             Optional. The name of the produced binary. The default
                        name of the binary is based on the binary type. For
                        example, if -t client is set then the file will be
                        rexray-client. If no type is set then the default file
                        name is rexray.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment