Browse Source

Merge pull request #2672 from dnephin/organize_scripts

Organize scripts into directories
Aanand Prasad 9 years ago
parent
commit
5111d0862c

+ 7 - 7
CONTRIBUTING.md

@@ -50,22 +50,22 @@ See Docker's [basic contribution workflow](https://docs.docker.com/opensource/wo
 Use the test script to run linting checks and then the full test suite against
 Use the test script to run linting checks and then the full test suite against
 different Python interpreters:
 different Python interpreters:
 
 
-    $ script/test
+    $ script/test/default
 
 
 Tests are run against a Docker daemon inside a container, so that we can test
 Tests are run against a Docker daemon inside a container, so that we can test
 against multiple Docker versions. By default they'll run against only the latest
 against multiple Docker versions. By default they'll run against only the latest
 Docker version - set the `DOCKER_VERSIONS` environment variable to "all" to run
 Docker version - set the `DOCKER_VERSIONS` environment variable to "all" to run
 against all supported versions:
 against all supported versions:
 
 
-    $ DOCKER_VERSIONS=all script/test
+    $ DOCKER_VERSIONS=all script/test/default
 
 
-Arguments to `script/test` are passed through to the `nosetests` executable, so
+Arguments to `script/test/default` are passed through to the `tox` executable, so
 you can specify a test directory, file, module, class or method:
 you can specify a test directory, file, module, class or method:
 
 
-    $ script/test tests/unit
-    $ script/test tests/unit/cli_test.py
-    $ script/test tests/unit/config_test.py::ConfigTest
-    $ script/test tests/unit/config_test.py::ConfigTest::test_load
+    $ script/test/default tests/unit
+    $ script/test/default tests/unit/cli_test.py
+    $ script/test/default tests/unit/config_test.py::ConfigTest
+    $ script/test/default tests/unit/config_test.py::ConfigTest::test_load
 
 
 ## Finding things to work on
 ## Finding things to work on
 
 

+ 1 - 1
appveyor.yml

@@ -11,7 +11,7 @@ build: false
 
 
 test_script:
 test_script:
   - "tox -e py27,py34 -- tests/unit"
   - "tox -e py27,py34 -- tests/unit"
-  - ps: ".\\script\\build-windows.ps1"
+  - ps: ".\\script\\build\\windows.ps1"
 
 
 artifacts:
 artifacts:
   - path: .\dist\docker-compose-Windows-x86_64.exe
   - path: .\dist\docker-compose-Windows-x86_64.exe

+ 3 - 3
project/RELEASE-PROCESS.md

@@ -57,8 +57,8 @@ When prompted build the non-linux binaries and test them.
 
 
 1.  Build the Mac binary in a Mountain Lion VM:
 1.  Build the Mac binary in a Mountain Lion VM:
 
 
-        script/prepare-osx
-        script/build-osx
+        script/setup/osx
+        script/build/osx
 
 
 2.  Download the windows binary from AppVeyor
 2.  Download the windows binary from AppVeyor
 
 
@@ -88,7 +88,7 @@ When prompted build the non-linux binaries and test them.
 
 
         ...release notes go here...
         ...release notes go here...
 
 
-5.  Attach the binaries and `script/run.sh`
+5.  Attach the binaries and `script/run/run.sh`
 
 
 6.  Add "Thanks" with a list of contributors. The contributor list can be generated
 6.  Add "Thanks" with a list of contributors. The contributor list can be generated
     by running `./script/release/contributors`.
     by running `./script/release/contributors`.

+ 1 - 1
script/build-image → script/build/image

@@ -10,7 +10,7 @@ fi
 TAG=$1
 TAG=$1
 VERSION="$(python setup.py --version)"
 VERSION="$(python setup.py --version)"
 
 
-./script/write-git-sha
+./script/build/write-git-sha
 python setup.py sdist
 python setup.py sdist
 cp dist/docker-compose-$VERSION.tar.gz dist/docker-compose-release.tar.gz
 cp dist/docker-compose-$VERSION.tar.gz dist/docker-compose-release.tar.gz
 docker build -t docker/compose:$TAG -f Dockerfile.run .
 docker build -t docker/compose:$TAG -f Dockerfile.run .

+ 1 - 1
script/build-linux → script/build/linux

@@ -7,7 +7,7 @@ set -ex
 TAG="docker-compose"
 TAG="docker-compose"
 docker build -t "$TAG" . | tail -n 200
 docker build -t "$TAG" . | tail -n 200
 docker run \
 docker run \
-    --rm --entrypoint="script/build-linux-inner" \
+    --rm --entrypoint="script/build/linux-entrypoint" \
     -v $(pwd)/dist:/code/dist \
     -v $(pwd)/dist:/code/dist \
     -v $(pwd)/.git:/code/.git \
     -v $(pwd)/.git:/code/.git \
     "$TAG"
     "$TAG"

+ 1 - 1
script/build-linux-inner → script/build/linux-entrypoint

@@ -9,7 +9,7 @@ mkdir -p `pwd`/dist
 chmod 777 `pwd`/dist
 chmod 777 `pwd`/dist
 
 
 $VENV/bin/pip install -q -r requirements-build.txt
 $VENV/bin/pip install -q -r requirements-build.txt
-./script/write-git-sha
+./script/build/write-git-sha
 su -c "$VENV/bin/pyinstaller docker-compose.spec" user
 su -c "$VENV/bin/pyinstaller docker-compose.spec" user
 mv dist/docker-compose $TARGET
 mv dist/docker-compose $TARGET
 $TARGET version
 $TARGET version

+ 1 - 1
script/build-osx → script/build/osx

@@ -9,7 +9,7 @@ virtualenv -p /usr/local/bin/python venv
 venv/bin/pip install -r requirements.txt
 venv/bin/pip install -r requirements.txt
 venv/bin/pip install -r requirements-build.txt
 venv/bin/pip install -r requirements-build.txt
 venv/bin/pip install --no-deps .
 venv/bin/pip install --no-deps .
-./script/write-git-sha
+./script/build/write-git-sha
 venv/bin/pyinstaller docker-compose.spec
 venv/bin/pyinstaller docker-compose.spec
 mv dist/docker-compose dist/docker-compose-Darwin-x86_64
 mv dist/docker-compose dist/docker-compose-Darwin-x86_64
 dist/docker-compose-Darwin-x86_64 version
 dist/docker-compose-Darwin-x86_64 version

+ 1 - 1
script/build-windows.ps1 → script/build/windows.ps1

@@ -26,7 +26,7 @@
 #
 #
 # 6. Build the binary:
 # 6. Build the binary:
 #
 #
-#        .\script\build-windows.ps1
+#        .\script\build\windows.ps1
 
 
 $ErrorActionPreference = "Stop"
 $ErrorActionPreference = "Stop"
 
 

+ 0 - 0
script/write-git-sha → script/build/write-git-sha


+ 6 - 19
script/ci

@@ -1,21 +1,8 @@
 #!/bin/bash
 #!/bin/bash
-# This should be run inside a container built from the Dockerfile
-# at the root of the repo:
 #
 #
-# $ TAG="docker-compose:$(git rev-parse --short HEAD)"
-# $ docker build -t "$TAG" .
-# $ docker run --rm --volume="/var/run/docker.sock:/var/run/docker.sock" --volume="$(pwd)/.git:/code/.git" -e "TAG=$TAG" --entrypoint="script/ci" "$TAG"
-
-set -ex
-
-docker version
-
-export DOCKER_VERSIONS=all
-STORAGE_DRIVER=${STORAGE_DRIVER:-overlay}
-export DOCKER_DAEMON_ARGS="--storage-driver=$STORAGE_DRIVER"
-
-GIT_VOLUME="--volumes-from=$(hostname)"
-. script/test-versions
-
->&2 echo "Building Linux binary"
-. script/build-linux-inner
+# Backwards compatiblity for jenkins
+#
+# TODO: remove this script after all current PRs and jenkins are updated with
+# the new script/test/ci change
+set -e
+exec script/test/ci

+ 0 - 21
script/dev

@@ -1,21 +0,0 @@
-#!/bin/bash
-# This is a script for running Compose inside a Docker container. It's handy for
-# development.
-#
-# $ ln -s `pwd`/script/dev /usr/local/bin/docker-compose
-# $ cd /a/compose/project
-# $ docker-compose up
-# 
-
-set -e
-
-# Follow symbolic links
-if [ -h "$0" ]; then
-    DIR=$(readlink "$0")
-else
-    DIR=$0
-fi
-DIR="$(dirname "$DIR")"/..
-
-docker build -t docker-compose $DIR
-exec docker run -i -t -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:`pwd` -w `pwd` docker-compose $@

+ 4 - 4
script/release/build-binaries

@@ -22,15 +22,15 @@ REPO=docker/compose
 
 
 # Build the binaries
 # Build the binaries
 script/clean
 script/clean
-script/build-linux
+script/build/linux
 # TODO: build osx binary
 # TODO: build osx binary
-# script/prepare-osx
-# script/build-osx
+# script/setup/osx
+# script/build/osx
 # TODO: build or fetch the windows binary
 # TODO: build or fetch the windows binary
 echo "You need to build the osx/windows binaries, that step is not automated yet."
 echo "You need to build the osx/windows binaries, that step is not automated yet."
 
 
 echo "Building the container distribution"
 echo "Building the container distribution"
-script/build-image $VERSION
+script/build/image $VERSION
 
 
 echo "Create a github release"
 echo "Create a github release"
 # TODO: script more of this https://developer.github.com/v3/repos/releases/
 # TODO: script more of this https://developer.github.com/v3/repos/releases/

+ 2 - 2
script/release/make-branch

@@ -65,10 +65,10 @@ git config "branch.${BRANCH}.release" $VERSION
 
 
 editor=${EDITOR:-vim}
 editor=${EDITOR:-vim}
 
 
-echo "Update versions in docs/install.md, compose/__init__.py, script/run.sh"
+echo "Update versions in docs/install.md, compose/__init__.py, script/run/run.sh"
 $editor docs/install.md
 $editor docs/install.md
 $editor compose/__init__.py
 $editor compose/__init__.py
-$editor script/run.sh
+$editor script/run/run.sh
 
 
 
 
 echo "Write release notes in CHANGELOG.md"
 echo "Write release notes in CHANGELOG.md"

+ 1 - 1
script/release/push-release

@@ -57,7 +57,7 @@ docker push docker/compose:$VERSION
 echo "Uploading sdist to pypi"
 echo "Uploading sdist to pypi"
 pandoc -f markdown -t rst README.md -o README.rst
 pandoc -f markdown -t rst README.md -o README.rst
 sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/master\/logo.png?raw=true/' README.rst
 sed -i -e 's/logo.png?raw=true/https:\/\/github.com\/docker\/compose\/raw\/master\/logo.png?raw=true/' README.rst
-./script/write-git-sha
+./script/build/write-git-sha
 python setup.py sdist
 python setup.py sdist
 if [ "$(command -v twine 2> /dev/null)" ]; then
 if [ "$(command -v twine 2> /dev/null)" ]; then
     twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz
     twine upload ./dist/docker-compose-${VERSION/-/}.tar.gz

+ 0 - 0
script/run.ps1 → script/run/run.ps1


+ 0 - 0
script/run.sh → script/run/run.sh


+ 0 - 0
script/prepare-osx → script/setup/osx


+ 0 - 4
script/shell

@@ -1,4 +0,0 @@
-#!/bin/sh
-set -ex
-docker build -t docker-compose .
-exec docker run -v /var/run/docker.sock:/var/run/docker.sock -v `pwd`:/code -ti --rm --entrypoint bash docker-compose

+ 1 - 1
script/test-versions → script/test/all

@@ -14,7 +14,7 @@ docker run --rm \
 get_versions="docker run --rm
 get_versions="docker run --rm
     --entrypoint=/code/.tox/py27/bin/python
     --entrypoint=/code/.tox/py27/bin/python
     $TAG
     $TAG
-    /code/script/versions.py docker/docker"
+    /code/script/test/versions.py docker/docker"
 
 
 if [ "$DOCKER_VERSIONS" == "" ]; then
 if [ "$DOCKER_VERSIONS" == "" ]; then
   DOCKER_VERSIONS="$($get_versions default)"
   DOCKER_VERSIONS="$($get_versions default)"

+ 25 - 0
script/test/ci

@@ -0,0 +1,25 @@
+#!/bin/bash
+# This should be run inside a container built from the Dockerfile
+# at the root of the repo:
+#
+# $ TAG="docker-compose:$(git rev-parse --short HEAD)"
+# $ docker build -t "$TAG" .
+# $ docker run --rm \
+#    --volume="/var/run/docker.sock:/var/run/docker.sock" \
+#    --volume="$(pwd)/.git:/code/.git" \
+#    -e "TAG=$TAG" \
+#    --entrypoint="script/test/ci" "$TAG"
+
+set -ex
+
+docker version
+
+export DOCKER_VERSIONS=all
+STORAGE_DRIVER=${STORAGE_DRIVER:-overlay}
+export DOCKER_DAEMON_ARGS="--storage-driver=$STORAGE_DRIVER"
+
+GIT_VOLUME="--volumes-from=$(hostname)"
+. script/test/all
+
+>&2 echo "Building Linux binary"
+. script/build/linux-entrypoint

+ 1 - 1
script/test → script/test/default

@@ -12,4 +12,4 @@ mkdir -p coverage-html
 docker build -t "$TAG" .
 docker build -t "$TAG" .
 
 
 GIT_VOLUME="--volume=$(pwd)/.git:/code/.git"
 GIT_VOLUME="--volume=$(pwd)/.git:/code/.git"
-. script/test-versions
+. script/test/all

+ 0 - 0
script/versions.py → script/test/versions.py


+ 4 - 4
script/travis/build-binary

@@ -3,11 +3,11 @@
 set -ex
 set -ex
 
 
 if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
 if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-    script/build-linux
+    script/build/linux
     # TODO: requires auth to push, so disable for now
     # TODO: requires auth to push, so disable for now
-    # script/build-image master
+    # script/build/image master
     # docker push docker/compose:master
     # docker push docker/compose:master
 else
 else
-    script/prepare-osx
-    script/build-osx
+    script/setup/osx
+    script/build/osx
 fi
 fi