Skip to content

Commit

Permalink
fix s3_local script; add docker init to CI on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
telamonian committed Apr 1, 2020
1 parent 648c1a1 commit 865f4e5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 20 deletions.
53 changes: 38 additions & 15 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ trigger:
- '*' # must quote since "*" is a YAML reserved character; we want a string

parameters:
- name: initializationSteps
- name: initSteps
type: stepList
default:
- task: UsePythonVersion@0
Expand Down Expand Up @@ -37,27 +37,47 @@ parameters:
- bash: env
displayName: "List all environment variables"
- name: s3proxySteps

- name: initDockerSteps
type: stepList
default:
- task: DockerInstaller@0
displayName: Docker Installer
inputs:
dockerVersion: 19.03.8
releaseType: stable

- name: initDockerStepsMac
type: stepList
default:
- script: |
ci/install_docker_desktop_mac.sh
ci/start_docker_desktop_mac.sh
displayName: 'Setup Docker Desktop Mac'
- name: initS3proxySteps
type: stepList
default:
- bash: nohup ci/s3_local.sh
- bash: |
nohup ci/s3_local.sh -d
sleep 5
displayName: "Start up local S3 server"
- script: curl http://127.0.0.1:9000/
displayName: 'Test local S3 server'
- name: s3proxyMacSteps

- name: initS3proxyStepsMac
type: stepList
default:
- script: |
ci/install_docker_desktop_mac.sh
ci/start_docker_desktop_mac.sh
docker pull andrewgaul/s3proxy
nohup sudo docker run -p 9000:80 --env S3PROXY_AUTHORIZATION=none andrewgaul/s3proxy &
sleep 5
sudo docker run --detach -p 9000:80 --env S3PROXY_AUTHORIZATION=none andrewgaul/s3proxy
sleep 15
displayName: 'Start s3proxy in a docker'
- script: curl http://127.0.0.1:9000/
displayName: 'Test local S3 server'

- name: testSteps
type: stepList
default:
Expand All @@ -72,6 +92,7 @@ parameters:

- script: make testjs
displayName: 'Test JS'

- name: publishSteps
type: stepList
default:
Expand All @@ -97,8 +118,9 @@ jobs:
python.version: '3.7'

steps:
- ${{ parameters.initializationSteps }}
- ${{ parameters.s3proxySteps }}
- ${{ parameters.initDockerSteps }}
- ${{ parameters.initS3proxySteps }}
- ${{ parameters.initSteps }}
- ${{ parameters.testSteps }}
- ${{ parameters.publishSteps }}

Expand All @@ -112,22 +134,23 @@ jobs:
python.version: '3.7'

steps:
- ${{ parameters.s3proxyMacSteps }}
- ${{ parameters.initializationSteps }}
- ${{ parameters.initDockerStepsMac }}
- ${{ parameters.initS3proxyStepsMac }}
- ${{ parameters.initSteps }}
- ${{ parameters.testSteps }}
- ${{ parameters.publishSteps }}

- job: 'Windows'
pool:
vmImage: 'vs2017-win2016'
vmImage: 'windows-2019'

strategy:
matrix:
Python37:
python.version: '3.7'

steps:
- ${{ parameters.initializationSteps }}
- ${{ parameters.s3proxySteps }}
- ${{ parameters.initS3proxySteps }}
- ${{ parameters.initSteps }}
- ${{ parameters.testSteps }}
- ${{ parameters.publishSteps }}
1 change: 0 additions & 1 deletion ci/s3_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ EOT
# s3proxy.credential=s3_local

# get built s3proxy jar
command -v java -jar s3proxy >/dev/null 2>&1 || \
curl -L https://github.com/gaul/s3proxy/releases/download/s3proxy-${S3PROXY_VERSION}/s3proxy -o s3proxy

# run s3proxy as a background job
Expand Down
8 changes: 4 additions & 4 deletions ci/start_docker_desktop_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ printf "Starting Docker.app, if necessary"
# Wait for the server to start up, if applicable.
retries=0
while ! docker system info &>/dev/null; do
if (( retries % 10 == 0 )); then
if (( retries % 30 == 0 )); then
if pgrep -xq -- "Docker"; then
printf '\nDocker init still running'
else
(( retries != 0 )) && printf '\nDocker not running, restart'
/Applications/Docker.app/Contents/MacOS/Docker &
open -g -a Docker.app || exit
fi

if [[ ${retries} -gt 150 ]]; then
>&2 printf '\nFailed to run Docker'
if [[ ${retries} -gt 600 ]]; then
printf '\nFailed to run Docker'
exit 1
fi
fi
Expand Down

0 comments on commit 865f4e5

Please sign in to comment.