Skip to content

Commit

Permalink
fix drone file
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach committed Sep 7, 2020
1 parent 1ca1bcc commit 8faff58
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
17 changes: 10 additions & 7 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def coreApiTestsEosStorage(ctx, coreBranch = 'master', coreCommit = '', part_num
'DIVIDE_INTO_NUM_PARTS': number_of_parts,
'RUN_PART': part_number,
'EXPECTED_FAILURES_FILE': '/drone/src/tests/acceptance/expected-failures-on-EOS-storage.txt',
'DELETE_USER_DATA_CMD': 'ssh -t root@${IPADDR} docker exec -it mgm-master eos -r 0 0 rm -r /eos/dockertest/reva/users/%s',
'DELETE_USER_DATA_CMD': 'ssh -t root@$IPADDR docker exec -it mgm-master eos -r 0 0 rm -r /eos/dockertest/reva/users/%s',
'DRONE_COMMIT_ID': ctx.build.commit,
'HCLOUD_TOKEN': {
'from_secret': 'hcloud_token',
Expand All @@ -356,16 +356,18 @@ def coreApiTestsEosStorage(ctx, coreBranch = 'master', coreCommit = '', part_num
'ln -s /root/go/bin/* /usr/local/bin',

'ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""',
'hcloud ssh-key create --name drone-$DRONE_COMMIT_ID-$RUN_PART --public-key-from-file /root/.ssh/id_rsa.pub',
'hcloud ssh-key create --name droneci-eos-test-$DRONE_COMMIT_ID-$RUN_PART --public-key-from-file /root/.ssh/id_rsa.pub',

'export SERVER_NAME=droneci-eos-test-$DRONE_COMMIT_ID-$RUN_PART',

# Create a new machine on hcloud for eos
'hcloud server create --type cx21 --image ubuntu-20.04 --ssh-key $SERVER_NAME --name $SERVER_NAME --label owner=$ME --label for=test --label from=eos-compose',
'hcloud server create --type cx21 --image ubuntu-20.04 --ssh-key $SERVER_NAME --name $SERVER_NAME --label owner=$DRONE_HCLOUD_USER --label for=test --label from=eos-compose',

# time for the server to start up
'sleep 15',

'export IPADDR=$(hcloud server ip ${SERVER_NAME})',
'export IPADDR=${IPADDR}',
'export TEST_SERVER_URL=https://${IPADDR}:9200',
'export IPADDR=$(hcloud server ip $SERVER_NAME)',
'export TEST_SERVER_URL=https://$IPADDR:9200',

'ssh -o StrictHostKeyChecking=no root@$IPADDR',

Expand All @@ -378,7 +380,8 @@ def coreApiTestsEosStorage(ctx, coreBranch = 'master', coreCommit = '', part_num
'make test-acceptance-api',

# Delete the eos machine
'hcloud server delete droneci-eos-test-%s-%s' % (ctx.build.commit, part_number)
'hcloud server delete droneci-eos-test-%s-%s' % (ctx.build.commit, part_number),
'hcloud ssh-key delete droneci-eos-test-%s-%s' % (ctx.build.commit, part_number),
],
'volumes': [{
'name': 'gopath',
Expand Down
4 changes: 2 additions & 2 deletions tests/config/drone/setup-eos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# wait for ocis to start
until $(curl -k --output /dev/null --silent --head --fail https://localhost:9200);
do
printf '.'
sleep 2
echo '.'
sleep 5
done

docker-compose -f ./docker-compose-eos-ci.yml exec -d ocis /start-ldap
Expand Down
20 changes: 10 additions & 10 deletions tests/spawn_eos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
ME=$DRONE_HCLOUD_USER
SERVER_NAME=droneci-eos-test-${DRONE_COMMIT_ID}-${RUN_PART}
# ME=$DRONE_HCLOUD_USER
# SERVER_NAME=droneci-eos-test-${DRONE_COMMIT_ID}-${RUN_PART}

# # setup ssh keys for hcloud
# ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
Expand All @@ -19,17 +19,17 @@ SERVER_NAME=droneci-eos-test-${DRONE_COMMIT_ID}-${RUN_PART}


# Setup system and clone ocis
ssh -t root@$IPADDR apt-get update -y
ssh -t root@$IPADDR apt-get install -y git screen docker.io docker-compose ldap-utils
ssh -t root@$IPADDR git clone https://github.com/owncloud/ocis.git /ocis
ssh -t root@$IPADDR "cd /ocis && git checkout $DRONE_COMMIT_ID"
ssh -tt root@$IPADDR apt-get update -y
ssh -tt root@$IPADDR apt-get install -y git screen docker.io docker-compose ldap-utils
ssh -tt root@$IPADDR git clone https://github.com/owncloud/ocis.git /ocis
ssh -tt root@$IPADDR "cd /ocis && git checkout $DRONE_COMMIT_ID"

# Create necessary files
ssh -t root@$IPADDR "cd /ocis/tests/config/drone && OCIS_DOMAIN=${IPADDR} bash /ocis/tests/config/drone/create-config.json.sh"
ssh -t root@$IPADDR "cd /ocis/tests/config/drone && OCIS_DOMAIN=${IPADDR} bash /ocis/tests/config/drone/create-identifier-registration.sh"
ssh -tt root@$IPADDR "cd /ocis/tests/config/drone && OCIS_DOMAIN=${IPADDR} bash /ocis/tests/config/drone/create-config.json.sh"
ssh -tt root@$IPADDR "cd /ocis/tests/config/drone && OCIS_DOMAIN=${IPADDR} bash /ocis/tests/config/drone/create-identifier-registration.sh"

# run ocis with eos
ssh -t root@$IPADDR "cd /ocis && OCIS_DOMAIN=${IPADDR} docker-compose -f ./docker-compose-eos-ci.yml up -d"
ssh -tt root@$IPADDR "cd /ocis && OCIS_DOMAIN=${IPADDR} docker-compose -f ./docker-compose-eos-ci.yml up -d"

# Some necessary configuration for eos
ssh -t root@$IPADDR "cd /ocis && bash /ocis/tests/config/drone/setup-eos.sh"
ssh -tt root@$IPADDR "cd /ocis && bash /ocis/tests/config/drone/setup-eos.sh"

0 comments on commit 8faff58

Please sign in to comment.