#!/bin/bash

set -e -o pipefail

# Hardcode configuration to open DC/OS.
VARIANT="open"
CHANNEL="testing/pull/1739"

JOB_NAME_SANITIZED=$(echo "$JOB_NAME" | tr -c '[:alnum:]-' '-')
DEPLOYMENT_NAME="$JOB_NAME_SANITIZED-$(date +%s)"

if [ "$VARIANT" == "open" ]; then
  TEMPLATE="https://s3.amazonaws.com/downloads.dcos.io/dcos/${CHANNEL}/cloudformation/single-master.cloudformation.json"
else
  TEMPLATE="https://s3.amazonaws.com/downloads.mesosphere.io/dcos-enterprise-aws-advanced/${CHANNEL}/${VARIANT}/cloudformation/ee.single-master.cloudformation.json"
fi

echo "Workspace: ${WORKSPACE}"
echo "Using: ${TEMPLATE}"

apk --upgrade add gettext wget
wget 'https://downloads.dcos.io/dcos-test-utils/bin/linux/dcos-launch' && chmod +x dcos-launch


envsubst <<EOF > config.yaml
---
launch_config_version: 1
template_url: $TEMPLATE
deployment_name: $DEPLOYMENT_NAME
provider: aws
aws_region: eu-central-1
template_parameters:
    KeyName: default
    AdminLocation: 0.0.0.0/0
    PublicSlaveInstanceCount: 1
    SlaveInstanceCount: 5
EOF
./dcos-launch create
./dcos-launch wait

#!/bin/bash

set -e -o pipefail

# Hardcode configuration to open DC/OS.
VARIANT="open"
CHANNEL="testing/pull/1739"

JOB_NAME_SANITIZED=$(echo "$JOB_NAME" | tr -c '[:alnum:]-' '-')
DEPLOYMENT_NAME="$JOB_NAME_SANITIZED-$(date +%s)"

if [ "$VARIANT" == "open" ]; then
  TEMPLATE="https://s3.amazonaws.com/downloads.dcos.io/dcos/${CHANNEL}/cloudformation/single-master.cloudformation.json"
else
  TEMPLATE="https://s3.amazonaws.com/downloads.mesosphere.io/dcos-enterprise-aws-advanced/${CHANNEL}/${VARIANT}/cloudformation/ee.single-master.cloudformation.json"
fi

echo "Workspace: ${WORKSPACE}"
echo "Using: ${TEMPLATE}"

apk update
apk --upgrade add gettext wget
wget 'https://downloads.dcos.io/dcos-test-utils/bin/linux/dcos-launch' && chmod +x dcos-launch


envsubst <<EOF > config.yaml
---
launch_config_version: 1
template_url: $TEMPLATE
deployment_name: $DEPLOYMENT_NAME
provider: aws
aws_region: eu-central-1
template_parameters:
    KeyName: default
    AdminLocation: 0.0.0.0/0
    PublicSlaveInstanceCount: 1
    SlaveInstanceCount: 5
EOF
./dcos-launch create
./dcos-launch wait

Update apk before installing dcos-launch.
Update apk before installing dcos-launch.

Summary:
A SI test job failed with

```
+ ci/system_integration.sh
Workspace: /jenkins/workspace/arathon-si-dcos-open_master-IRDXSZEZJZCOBUKGGDBER53XZEBMNPJQQVMQ2IHJABLLBL4OTQEA
Using: https://s3.amazonaws.com/downloads.dcos.io/dcos/testing/pull/1739/cloudformation/single-master.cloudformation.json
(1/6) Installing libgomp (6.4.0-r4)
ERROR: libgomp-6.4.0-r4: package mentioned in index not found (try 'apk update')
```

So let's run update.

Test Plan: https://jenkins.mesosphere.com/service/jenkins/view/Marathon-Dashboard/job/System%20Integration%20Tests/job/marathon-si-dcos-open/job/karsten%252Fapk-update/

Reviewers: unterstein, ichernetsky, kensipe, jenkins

Reviewed By: ichernetsky, kensipe, jenkins

Subscribers: marathon-dev, marathon-team, jenkins

Differential Revision: https://phabricator.mesosphere.com/D1013
