Page MenuHomeDevCentral

D2232.id5613.diff
No OneTemporary

D2232.id5613.diff

diff --git a/roles/paas-docker/devel/files/arc.sh b/roles/paas-docker/devel/files/arc.sh
new file mode 100755
--- /dev/null
+++ b/roles/paas-docker/devel/files/arc.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Phabricator — Arcanist Docker container wrapper
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Author: Sébastien Santoro aka Dereckson
+# Project: Nasqueron
+# Created: 2016-01-01
+# Description: Wrapper to run Arcanist as a Docker container
+# License: Trivial work, not eligible to copyright
+# Image: nasqueron/arcanist
+# Source file: roles/paas-docker/devel/files/arc.sh
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Parse arguments
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ -t 0 ]; then
+ # If a stdin entry is available
+ # launch the container in the
+ # interactive mode
+ FLAGS=-it
+fi
+
+# Logs are default disabled
+PRINT_LOG=0
+
+if [ "$1" = "shell" ]; then
+ # Launch commands
+ # in the container bash shell
+ shift
+ COMMAND=bash
+else
+ # Launch arc
+ mkdir -p ~/.arc
+ COMMAND=arc
+
+ if [ "$1" = "call-conduit" ]; then
+ # Enable log printing
+ PRINT_LOG=1
+ # Set a random name for the container
+ INSTANCE="arc-"$(openssl rand -hex 21)
+ FLAGS="-i -a=stdin --name=$INSTANCE"
+ fi
+fi
+
+if [ -d ~/.arc/ssh ]; then
+ VOLUME_SSH="-v $HOME/.arc/ssh:/root/.ssh"
+else
+ VOLUME_SSH=""
+fi
+
+# -------------------------------------------------------------
+# Run container
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ $PRINT_LOG -eq 0 ]; then
+ docker run $FLAGS --rm -v ~/.arc:/opt/config -v "$PWD:/opt/workspace" $VOLUME_SSH nasqueron/arcanist $COMMAND "$@"
+else
+ docker run $FLAGS -v ~/.arc:/opt/config -v "$PWD:/opt/workspace" $VOLUME_SSH nasqueron/arcanist $COMMAND "$@" > /dev/null
+ sleep 3
+ docker logs "$INSTANCE"
+ docker rm "$INSTANCE" >/dev/null
+fi
diff --git a/roles/paas-docker/devel/software.sls b/roles/paas-docker/devel/software.sls
--- a/roles/paas-docker/devel/software.sls
+++ b/roles/paas-docker/devel/software.sls
@@ -6,7 +6,7 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% from "map.jinja" import packages_prefixes with context %}
+{% from "map.jinja" import dirs, packages_prefixes with context %}
# -------------------------------------------------------------
# Dependencies not required in production but useful in dev
@@ -23,3 +23,14 @@
- name: docker-compose
- require:
- pkg: docker_development_utilities
+
+# -------------------------------------------------------------
+# Tools
+#
+# :: Arcanist
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+{{ dirs.bin }}/arc:
+ file.managed:
+ - source: salt://roles/paas-docker/devel/files/arc.sh
+ - mode: 755

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 14:18 (7 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260343
Default Alt Text
D2232.id5613.diff (3 KB)

Event Timeline