All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] automation: standardize containerize env names
       [not found] <cover.1acf9637303405d6bdb1a9ad450b2a4ea5a0307d.1532797834.git-series.cardoe@cardoe.com>
@ 2018-07-28 17:11 ` Doug Goldstein
  2018-07-30 14:38   ` Wei Liu
  2018-07-28 17:11 ` [PATCH 2/4] automation: drop container name from containerize Doug Goldstein
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Doug Goldstein @ 2018-07-28 17:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Wei Liu

Standardized all the environment variable names that the containerize
script uses to start with CONTAINER_

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/build/README.md      | 10 +++++-----
 automation/scripts/containerize | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index be4526c..987533a 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -40,13 +40,16 @@ understands.
   CONTAINER=centos72 ./automation/scripts/containerize make
   ```
 
-- WORKDIR: This overrides the path that will be available under the
+- CONTAINER_PATH: This overrides the path that will be available under the
   `/build` directory in the container, which is the default path.
 
   ```
-  WORKDIR=/some/other/path ./automation/scripts/containerize ls
+  CONTAINER_PATH=/some/other/path ./automation/scripts/containerize ls
   ```
 
+- CONTAINER_ARGS: Allows you to pass extra arguments to Docker
+  when starting the container.
+
 - XEN_CONFIG_EXPERT: If this is defined in your shell it will be
   automatically passed through to the container.
 
@@ -56,9 +59,6 @@ understands.
   of the same version. Override the name value to cause it to name
   the container differently on start.
 
-- EXTRA_CONTAINER_ARGS: Allows you to pass extra arguments to Docker
-  when starting the container.
-
 Building a container
 --------------------
 
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 7253617..010ed39 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -71,10 +71,10 @@ fi
 
 # Figure out the base of what we want as our sources
 # by using the top of the git repo
-if [[ -n ${WORKDIR} ]]; then
-    WORKDIR="${WORKDIR}"
+if [[ -n ${CONTAINER_PATH} ]]; then
+    :
 else
-    WORKDIR=$(git rev-parse --show-toplevel)
+    CONTAINER_PATH=$(git rev-parse --show-toplevel)
 fi
 
 # Kick off Docker
@@ -82,11 +82,11 @@ einfo "*** Launching container ..."
 exec docker run \
     ${DOCKER_ARGS} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
-    -v "${WORKDIR}":/build:rw \
+    -v "${CONTAINER_PATH}":/build:rw \
     -v "${HOME}/.ssh":/root/.ssh:ro \
     ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent} \
     ${XEN_CONFIG_EXPERT:+-e XEN_CONFIG_EXPERT=${XEN_CONFIG_EXPERT}} \
-    ${EXTRA_CONTAINER_ARGS} ${name} \
+    ${CONTAINER_ARGS} ${name} \
     -${termint}i --rm -- \
     ${CONTAINER} \
     ${cmd}
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] automation: drop container name from containerize
       [not found] <cover.1acf9637303405d6bdb1a9ad450b2a4ea5a0307d.1532797834.git-series.cardoe@cardoe.com>
  2018-07-28 17:11 ` [PATCH 1/4] automation: standardize containerize env names Doug Goldstein
@ 2018-07-28 17:11 ` Doug Goldstein
  2018-07-30 14:44   ` Wei Liu
  2018-07-28 17:11 ` [PATCH 3/4] automation: remove dead code " Doug Goldstein
  2018-07-28 17:11 ` [PATCH 4/4] automation: ensure created are not owned as root Doug Goldstein
  3 siblings, 1 reply; 8+ messages in thread
From: Doug Goldstein @ 2018-07-28 17:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Wei Liu

This was something that existed for some scripting support for a totally
unrelated project and when I copied this script I failed to remove it so
this removes it. Build containers for Xen are best as ephemeral
environments and should just utilizes Docker's default container naming
behavior.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/build/README.md      | 5 -----
 automation/scripts/containerize | 7 +------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index 987533a..bf11317 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -53,11 +53,6 @@ understands.
 - XEN_CONFIG_EXPERT: If this is defined in your shell it will be
   automatically passed through to the container.
 
-- CONTAINER_NAME: By default the container name is set based on the
-  container itself so that its easy to attach other terminals to your
-  container. This however prevents you from running multiple containers
-  of the same version. Override the name value to cause it to name
-  the container differently on start.
 
 Building a container
 --------------------
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 010ed39..2cb8021 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -64,11 +64,6 @@ if [[ -n ${SSH_AUTH_SOCK} ]]; then
     fi
 fi
 
-# if we got the CONTAINER_NAME env variable then use that for our name
-if [[ -n ${CONTAINER_NAME} ]]; then
-    name="--name ${CONTAINER_NAME}"
-fi
-
 # Figure out the base of what we want as our sources
 # by using the top of the git repo
 if [[ -n ${CONTAINER_PATH} ]]; then
@@ -86,7 +81,7 @@ exec docker run \
     -v "${HOME}/.ssh":/root/.ssh:ro \
     ${SSH_AUTH_DIR:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent} \
     ${XEN_CONFIG_EXPERT:+-e XEN_CONFIG_EXPERT=${XEN_CONFIG_EXPERT}} \
-    ${CONTAINER_ARGS} ${name} \
+    ${CONTAINER_ARGS} \
     -${termint}i --rm -- \
     ${CONTAINER} \
     ${cmd}
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] automation: remove dead code from containerize
       [not found] <cover.1acf9637303405d6bdb1a9ad450b2a4ea5a0307d.1532797834.git-series.cardoe@cardoe.com>
  2018-07-28 17:11 ` [PATCH 1/4] automation: standardize containerize env names Doug Goldstein
  2018-07-28 17:11 ` [PATCH 2/4] automation: drop container name from containerize Doug Goldstein
@ 2018-07-28 17:11 ` Doug Goldstein
  2018-07-30 14:44   ` Wei Liu
  2018-07-28 17:11 ` [PATCH 4/4] automation: ensure created are not owned as root Doug Goldstein
  3 siblings, 1 reply; 8+ messages in thread
From: Doug Goldstein @ 2018-07-28 17:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Wei Liu

This is more dead code.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/scripts/containerize | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 2cb8021..d17f5ff 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -22,10 +22,6 @@ case "_${CONTAINER}" in
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
 esac
 
-# get our container name and version
-containid=${CONTAINER%:*}
-containver=${CONTAINER#*:}
-
 # Save the commands for future use
 cmd=$@
 
@@ -75,7 +71,6 @@ fi
 # Kick off Docker
 einfo "*** Launching container ..."
 exec docker run \
-    ${DOCKER_ARGS} \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
     -v "${HOME}/.ssh":/root/.ssh:ro \
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] automation: ensure created are not owned as root
       [not found] <cover.1acf9637303405d6bdb1a9ad450b2a4ea5a0307d.1532797834.git-series.cardoe@cardoe.com>
                   ` (2 preceding siblings ...)
  2018-07-28 17:11 ` [PATCH 3/4] automation: remove dead code " Doug Goldstein
@ 2018-07-28 17:11 ` Doug Goldstein
  2018-07-30 14:44   ` Wei Liu
  3 siblings, 1 reply; 8+ messages in thread
From: Doug Goldstein @ 2018-07-28 17:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Wei Liu

By default the container runs as the root user and since the source tree
is bind mounted into the container, any file is created and owned by the
root user which harms ergonomics when working outside of the container
environment. This maps the root user within the container to the uid of
the user outside of the container so files are not owned by root.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
 automation/scripts/containerize | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index d17f5ff..7d297d7 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -71,6 +71,7 @@ fi
 # Kick off Docker
 einfo "*** Launching container ..."
 exec docker run \
+    -u $(id -u) \
     ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \
     -v "${CONTAINER_PATH}":/build:rw \
     -v "${HOME}/.ssh":/root/.ssh:ro \
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/4] automation: standardize containerize env names
  2018-07-28 17:11 ` [PATCH 1/4] automation: standardize containerize env names Doug Goldstein
@ 2018-07-30 14:38   ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2018-07-30 14:38 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: xen-devel, Wei Liu

On Sat, Jul 28, 2018 at 12:11:49PM -0500, Doug Goldstein wrote:
>  # Figure out the base of what we want as our sources
>  # by using the top of the git repo
> -if [[ -n ${WORKDIR} ]]; then
> -    WORKDIR="${WORKDIR}"
> +if [[ -n ${CONTAINER_PATH} ]]; then
> +    :
>  else
> -    WORKDIR=$(git rev-parse --show-toplevel)
> +    CONTAINER_PATH=$(git rev-parse --show-toplevel)

I think you can use -z here and get rid of the empty branch?

The rest looks fine.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/4] automation: drop container name from containerize
  2018-07-28 17:11 ` [PATCH 2/4] automation: drop container name from containerize Doug Goldstein
@ 2018-07-30 14:44   ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2018-07-30 14:44 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: xen-devel, Wei Liu

On Sat, Jul 28, 2018 at 12:11:50PM -0500, Doug Goldstein wrote:
> This was something that existed for some scripting support for a totally
> unrelated project and when I copied this script I failed to remove it so
> this removes it. Build containers for Xen are best as ephemeral
> environments and should just utilizes Docker's default container naming
> behavior.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/4] automation: remove dead code from containerize
  2018-07-28 17:11 ` [PATCH 3/4] automation: remove dead code " Doug Goldstein
@ 2018-07-30 14:44   ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2018-07-30 14:44 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: xen-devel, Wei Liu

On Sat, Jul 28, 2018 at 12:11:51PM -0500, Doug Goldstein wrote:
> This is more dead code.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] automation: ensure created are not owned as root
  2018-07-28 17:11 ` [PATCH 4/4] automation: ensure created are not owned as root Doug Goldstein
@ 2018-07-30 14:44   ` Wei Liu
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Liu @ 2018-07-30 14:44 UTC (permalink / raw)
  To: Doug Goldstein; +Cc: xen-devel, Wei Liu

On Sat, Jul 28, 2018 at 12:11:52PM -0500, Doug Goldstein wrote:
> By default the container runs as the root user and since the source tree
> is bind mounted into the container, any file is created and owned by the
> root user which harms ergonomics when working outside of the container
> environment. This maps the root user within the container to the uid of
> the user outside of the container so files are not owned by root.
> 
> Signed-off-by: Doug Goldstein <cardoe@cardoe.com>

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-07-30 14:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1acf9637303405d6bdb1a9ad450b2a4ea5a0307d.1532797834.git-series.cardoe@cardoe.com>
2018-07-28 17:11 ` [PATCH 1/4] automation: standardize containerize env names Doug Goldstein
2018-07-30 14:38   ` Wei Liu
2018-07-28 17:11 ` [PATCH 2/4] automation: drop container name from containerize Doug Goldstein
2018-07-30 14:44   ` Wei Liu
2018-07-28 17:11 ` [PATCH 3/4] automation: remove dead code " Doug Goldstein
2018-07-30 14:44   ` Wei Liu
2018-07-28 17:11 ` [PATCH 4/4] automation: ensure created are not owned as root Doug Goldstein
2018-07-30 14:44   ` Wei Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.