Skip to content

Commit

Permalink
Updated prompt in CLI Docker image. Added ability to build 'edge' ver…
Browse files Browse the repository at this point in the history
…sion
  • Loading branch information
mwvaughn committed Jun 20, 2017
1 parent 170a530 commit fffd174
Show file tree
Hide file tree
Showing 384 changed files with 53,579 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Dockerfile
Expand Up @@ -7,7 +7,7 @@
#
# This container a Cyverse-branded, customized Agave CLI
#
# docker run -it -v $HOME/.agave:/root/.agave iplantc/cyverse-cli bash
# docker run -it -v $HOME/.agave:/root/.agave cyverse/cyverse-cli bash
#
######################################################

Expand All @@ -28,15 +28,14 @@ RUN curl -L -sk -o /usr/local/bin/jq "https://github.com/stedolan/jq/releases/do
ADD cyverse-cli /usr/local/agave-cli
ENV PATH $PATH:/usr/local/agave-cli/bin

RUN echo export PS1=\""\[\e[32;4m\]cyverse-cli\[\e[0m\]:\u@\h:\w$ "\" >> /root/.bashrc
# RUN echo export PS1=\""\[\e[32;4m\]agave-cli\[\e[0m\]:$AGAVE_TENANT:$AGAVE_USERNAME@\h:\w$ "\" >> /root/.bashrc

# set user's default env. This won't get sourced, but is helpful

# set user's default env. This won't get sourced, but is helpful
# Set user's default env. This won't get sourced, but is helpful
RUN echo HOME=/root >> /root/.bashrc && \
echo AGAVE_CACHE_DIR=/root/.agave >> /root/.bashrc

RUN /usr/local/agave-cli/bin/tenants-init -t iplantc.org
echo AGAVE_CACHE_DIR=/root/.agave >> /root/.bashrc && \
echo PROMPT_COMMAND=/usr/local/agave-cli/bin/prompt_command >> /root/.bashrc && \
echo export PS1=\"\\h:\\w\$ \" >> /root/.bashrc && \
usr/local/agave-cli/bin/tenants-init -t iplantc.org

# Runtime parameters. Start a shell by default
VOLUME /root/.agave
Expand Down
19 changes: 19 additions & 0 deletions build/develop.sh
@@ -0,0 +1,19 @@
#!/bin/bash

cp VERSION VERSION.bak
echo "edge" > VERSION

_VERSION="$(echo -n $(cat VERSION))"
make clean
make dist
make clean

git commit -a -m "Building release ${_VERSION}"
git tag -a "v${_VERSION}" -m "version ${_VERSION}"
git push origin "v${_VERSION}"
git push origin master

make docker
make docker-release

mv VERSION.bak VERSION
8 changes: 8 additions & 0 deletions cli/.dockerignore
@@ -0,0 +1,8 @@
/bin/transforms-apply
auth-filter.sh
playground

auth-switch
transfers-*
bin/actors-*
docker
44 changes: 44 additions & 0 deletions cli/.gitignore
@@ -0,0 +1,44 @@
# Binary targets
target
*~

# Intellij metadata files
*.idea
*.ids
*.iml
*.eml
*.ids
*.imp
*.ipr
*.iws

# Eclipse metadata files
.project
.settings
.classpath

# Apple system files
.DS_Store
.AppleDouble
.LSOverride
Icon

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Dev scripts
transforms-apply
auth-filter.sh
auth-switch-filter.sh
playground
actors-*
transfers-*

# test data
test/data/*
TestReport-case.xml
*.pyc
103 changes: 103 additions & 0 deletions cli/CHANGELOG.md
@@ -0,0 +1,103 @@
# Change Log
All notable changes to this project will be documented in this file.

## 2.1.9.0 - 2016-10-14
### ADDED
- `uuid-lookup` script to resolve generic uuid and optionally return the full object representation. Relies on the beta `/uuids` API.

### FIXED
- Fixed parsing issue in `requestbin-create` and `systems-history` scripts
- Fixed `jobs-template` and added logic to make it more forgiving when a user profile does not resolve or an input has a null default value.

### REMOVED
- No changes.


## 2.1.8.1 - 2016-07-13
### ADDED
- `Dockerfile` to build a minimal image with embedded webhook server written in Golang and `ngrok.com` reverse tunnel for local webhook inspection behind a proxy.

### FIXED
- Fixed a bug in `systems-roles-addupdate` where the curl statement was misprinting.

### REMOVED
- No changes.


## 2.1.8 - 2016-06-13
### ADDED
- `jobs-kick` command to roll a job back to its previous status and retry processing from there.
- Added search support to the `monitors-checks-list` command.
- Added support for specify custom notification delivery retry policy in the `notifications-addupdate` script.
- Adding support for strict validation of inputs and paramters in the `jobs-resubmit` script. You can now use the `-I` and `--strictinputs` to enforce strict reproducibility on the submissi on syntax and `-P` and `--strictparams` to enforce strict reproducibility on the input syntax. Thes allow you to shield yourself against changes to the app descriptions that would otherwise silently go through.

### FIXED
- Fixed a bug in `monitors-addupdate` preventing json descriptions from being read from stdin.
- Fixed a bug where the veryverbose output of the `systems-list` script did not quote the url.

### REMOVED
- No changes.


## 2.1.5 - 2016-03-09
### ADDED
- No changes.

### FIXED
- Overhauled parameters and script docs for correctness and consistency.

### REMOVED
- No changes.

## 2.1.4 - 2015-09-14
### ADDED
- `*-search` Adding support for deep, sql style searching across first-class resources
- `files-output-list` and `jobs-list` now have -L option to print out file listing in unix-y format
- `systems-queues-*` commands for crud actions on system queues.

### FIXED
- Fixed random typos in error messages.
- All `*-search` commands now properly url-encoded serach terms.
- Exit code on errors is now returned as 1.
- Fixed parameter-based notifications creation.
- Fixing bug in auth-switch command preventing dev and primary url from being set properly.

### REMOVED
- No changes.

## 2.1.0 - 2015-02-23
### ADDED
- `*-addupdate` Adding support for reading from stdin to all the scripts that previously accepted only files by replacing the file name with `-`
- `jobs-template` adding webhook url with [Agave RequestBin](http://requestbin.agaveapi.co/) valid for 24 hours created on each request.
- `jobs-template` added support for parsing most enum values, properly creating arrays vs primary types based on min and max cardinality, and the ability to populate with random default values, including inputs

### FIXED
- Fixed existence check on all commands accepting files/folder inputs.

### REMOVED
- No changes.


## 2.1.0 - 2015-02-22
### ADDED
- `files-publish` script providing a single command to upload a file/folder and create a public PostIt URL that can be shared. All arguments of the `files-upload` and `postits-create` commands are supported.
- `jobs-output-list` script replaces the default directory listing behavior of the `jobs-output` command.
- `jobs-output-get` script replaces the download behavior of the `jobs-output` command. This script supercedes the previous command by adding recursive directory downloads, range query support, and optional printing to standard out.

### FIXED
- No changes.

### REMOVED
- `jobs-output` has been deprecated and now delegates all calls to the `jobs-output-list` and `jobs-output-get` commands.


## 2.0.0 - 2014-12-10
### ADDED
- `clients-create` Broke client JSON into individual command line arguments.
- `tenants-init` Added ability to specify tenant by id or name.

### FIXED
- `tenants-init` Fixed a bug where the tenant id given at the command line was not being recognized.

### REMOVED
- No changes.
27 changes: 27 additions & 0 deletions cli/COPYRIGHT
@@ -0,0 +1,27 @@
Copyright (c) 2013, University of Texas at Austin
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the University of Texas at Austin nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
122 changes: 122 additions & 0 deletions cli/Dockerfile
@@ -0,0 +1,122 @@
######################################################
#
# Agave CLI Image
# Tag: agave-cli
#
# https://bitbucket.org/agaveapi/cli
#
# This is the official image for the Agave CLI and can be used for
# parallel environment testing.
#
# docker run -it -v $HOME/.agave:/agave agaveapi/cli bash
#
######################################################

FROM ubuntu:trusty

MAINTAINER Rion Dooley <dooley@tacc.utexas.edu>

# base environment and user
ENV CLI_USER agave
ENV AGAVE_CLI_HOME /usr/local/agave-cli

# update dependencies
RUN apt-get update && \
apt-get install -y git vim.tiny curl jq unzip bsdmainutils ttyrec

# Create non-root user.
RUN mkdir /home/$CLI_USER && \
cp /etc/skel/.bash* /home/$CLI_USER/ && \
cp /etc/skel/.profile /home/$CLI_USER/ && \
echo "$CLI_USER:x:6737:6737:Ngrok user:/home/$CLI_USER:/bin/false" >> /etc/passwd && \
echo "$CLI_USER:x:6737:" >> /etc/group && \
chown -R $CLI_USER:$CLI_USER /home/$CLI_USER && \
chmod -R go=u,go-w /home/$CLI_USER && \
chmod go= /home/$CLI_USER

# configure ngrok to locally receive webhooks behind a NAT
RUN curl -sk -o /ngrok.zip 'https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip' && \
unzip ngrok.zip -d /bin && \
rm -f ngrok.zip && \

mkdir -p $AGAVE_CLI_HOME/http/log && \
touch $AGAVE_CLI_HOME/http/log/httpmirror.log && \
chown -R $CLI_USER:$CLI_USER $AGAVE_CLI_HOME/http/log && \
mkdir /.ngrok2 && \
echo "web_addr: 0.0.0.0:4040" >> /.ngrok2/ngrok.yml && \
chmod -R 755 /.ngrok2 && \
echo alias ngrok_url=\''curl -s http://localhost:4040/api/tunnels | jq -r ".tunnels[0].public_url"'\' >> /home/$CLI_USER/.bashrc

# install bats test harness
RUN git clone https://github.com/calj/bats.git && \
cd bats && \
./install.sh /usr/local

# configure environment and init default tenant
RUN echo export PS1=\""\[\e[32;4m\]agave-cli\[\e[0m\]:\u@\h:\w$ "\" >> /home/$CLI_USER/.bashrc && \
echo 'export PATH=$PATH:$AGAVE_CLI_HOME/bin:$AGAVE_CLI_HOME/http/bin' >> /home/$CLI_USER/.bashrc && \

# Fix the vim.tiny terminal emulation
curl -sk 'https://bitbucket.org/!api/2.0/snippets/deardooley/AEddG/master/files/.vimrc' >> /home/$CLI_USER/.vimrc && \

mkdir /agave && \
chown -R $CLI_USER:$CLI_USER /agave && \
chown -R $CLI_USER:$CLI_USER $AGAVE_CLI_HOME


# switch to cli user so we don't run as root
USER $CLI_USER
WORKDIR /home/$CLI_USER

# enable bash completion
RUN echo ". $AGAVE_CLI_HOME/completion/agave-cli" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_SHOW_FILES=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_SHOW_JOB_OUTPUTS_PATHS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_APPS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_CLIENTS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_FILES=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_JOBS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_METADATA=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_MONITORS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_NOTIFICATIONS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_POSTITS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_PROFILES=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_SYSTEMS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_TAGS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_TENANTS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_TRANSFERS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_CACHE_TRANFORMS=yes" >> $HOME/.bashrc && \
echo "export AGAVE_CLI_COMPLETION_SHOW_FILE_PATHS=yes" >> $HOME/.bashrc

ENV PS1 "\[\e[32;4m\]agave-cli\[\e[0m\]:\u@\h:\w$ "
ENV SHELL /bin/bash
ENV HTTP_PORT 3000
ENV PATH $PATH:$AGAVE_CLI_HOME/bin:$AGAVE_CLI_HOME/http/bin
ENV AGAVE_DEVEL_MODE ''
ENV AGAVE_DEVURL ''
ENV AGAVE_CACHE_DIR /agave
ENV AGAVE_JSON_PARSER jq
ENV WEBHOOK_LOG $AGAVE_CLI_HOME/http/log/httpmirror.log
ENV TERM xterm

# add CLI assets
COPY . $AGAVE_CLI_HOME

# init public denant by default
RUN auth-switch -b https://public.agaveapi.co -t agave.prod -S

# shipping a static binary to save some build time. uncomment to rebuild binary from source
#RUN apt-get install -y golang && \
# cd $AGAVE_CLI_HOME/http && \
# GOBIN=$AGAVE_CLI_HOME/http/bin go install src/HttpMirror.go && \
# apt-get remove -y golang


EXPOSE 4040

# Runtime parameters. Start a shell by default
VOLUME /agave
VOLUME /home/agave
VOLUME /usr/local/agave-cli

CMD "/bin/bash"
27 changes: 27 additions & 0 deletions cli/LICENSE
@@ -0,0 +1,27 @@
Copyright (c) 2013, Texas Advanced Computing Center
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the University of Texas at Austin nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 comments on commit fffd174

Please sign in to comment.