forked from charmed-kubernetes/jenkins
/
juju-attach-resources.sh
executable file
·33 lines (24 loc) · 1.36 KB
/
juju-attach-resources.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
# Attaches local resources to Kubernetes charms.
# The first argument is the _relative_ resources directory.
set -o errexit # Exit when an individual command fails.
set -o pipefail # The exit status of the last command is returned.
set -o xtrace # Print the commands that are executed.
echo "${0} started at `date`."
RESOURCES_DIRECTORY=${1:-"resources"}
ARCH=${ARCH:-"amd64"}
# Get the _relative_ resource names.
E2E_RESOURCE=$(ls -1 ${RESOURCES_DIRECTORY}/e2e-*-${ARCH}.tar.gz)
EASYRSA_RESOURCE=$(ls -1 ${RESOURCES_DIRECTORY}/easyrsa-resource-*.tgz)
FLANNEL_RESOURCE=$(ls -1 ${RESOURCES_DIRECTORY}/flannel-resource-*-${ARCH}.tar.gz)
MASTER_RESOURCE=$(ls -1 ${RESOURCES_DIRECTORY}/kubernetes-master-*-${ARCH}.tar.gz)
WORKER_RESOURCE=$(ls -1 ${RESOURCES_DIRECTORY}/kubernetes-worker-*-${ARCH}.tar.gz)
# Define the juju functions.
source ./define-juju.sh
# Attach the resources using the workspace directory inside the container.
juju attach easyrsa easyrsa=/home/ubuntu/workspace/${EASYRSA_RESOURCE}
juju attach flannel flannel=/home/ubuntu/workspace/${FLANNEL_RESOURCE}
juju attach kubernetes-e2e e2e_${ARCH}=/home/ubuntu/workspace/${E2E_RESOURCE}
juju attach kubernetes-master kubernetes=/home/ubuntu/workspace/${MASTER_RESOURCE}
juju attach kubernetes-worker kubernetes=/home/ubuntu/workspace/${WORKER_RESOURCE}
echo "${0} completed successfully at `date`."