Small refactoring for packer scripts
* Get rid of formula version variable and use MCP_VERSION instead
* Remove docker images pull
* Remove adding of jenkins theme b/c it's already inside docker image
* Move flag for jenkins in docker to /opt
Closes-task: #PROD-24048 (PROD:24048)
Change-Id: I41a1c4771d9cf890bd371264a35727ded6fc52a8
diff --git a/common/ubuntu_salt_bootstrap.sh b/common/ubuntu_salt_bootstrap.sh
index e923866..e0e5ff4 100644
--- a/common/ubuntu_salt_bootstrap.sh
+++ b/common/ubuntu_salt_bootstrap.sh
@@ -6,20 +6,20 @@
fi
#
CLUSTER_NAME=${CLUSTER_NAME:-lost_cluster_name_variable}
-FORMULA_VERSION=${FORMULA_VERSION:-testing}
+MCP_VERSION=${MCP_VERSION:-testing}
SALTSTACK_GPG=${SALTSTACK_GPG:-"https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"}
SALTSTACK_REPO=${SALTSTACK_REPO:-"http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7 xenial main"}
APT_MIRANTIS_GPG=${APT_MIRANTIS_GPG:-"http://apt.mirantis.com/public.gpg"}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
function process_repos(){
# TODO: those should be unhardcoded and re-writed, using CC model
wget -O - ${SALTSTACK_GPG} | sudo apt-key add -
wget -O - ${APT_MIRANTIS_GPG} | apt-key add -
-wget -O - http://mirror.mirantis.com/${FORMULA_VERSION}/extra/xenial/archive-extra.key | apt-key add -
+wget -O - http://mirror.mirantis.com/${MCP_VERSION}/extra/xenial/archive-extra.key | apt-key add -
echo "deb [arch=amd64] ${SALTSTACK_REPO}" > /etc/apt/sources.list.d/mcp_saltstack.list
-echo "deb [arch=amd64] http://mirror.mirantis.com/${FORMULA_VERSION}/extra/xenial xenial main" > /etc/apt/sources.list.d/mcp_extra.list
+echo "deb [arch=amd64] http://mirror.mirantis.com/${MCP_VERSION}/extra/xenial xenial main" > /etc/apt/sources.list.d/mcp_extra.list
# This Pin-Priority fix should be always aligned with
# https://github.com/Mirantis/reclass-system-salt-model/blob/master/linux/system/repo/mcp/apt_mirantis/saltstack.yml
diff --git a/day01-image/run.example.sh b/day01-image/run.example.sh
index bc4a811..6277a71 100755
--- a/day01-image/run.example.sh
+++ b/day01-image/run.example.sh
@@ -18,7 +18,6 @@
export MCP_VERSION=proposed
export SCRIPTS_REF=master
export CLUSTER_NAME=mcp-day01
-export FORMULA_VERSION=proposed
export UBUNTU_BASEURL="http://mirror.mirantis.com/proposed/ubuntu/"
export SALTSTACK_REPO="http://mirror.mirantis.com/proposed/saltstack-2017.7/xenial xenial main"
export APT_MIRANTIS_GPG="http://apt.mirantis.com/public.gpg"
diff --git a/day01-image/scripts/salt.sh b/day01-image/scripts/salt.sh
index ffa106b..6074f21 100644
--- a/day01-image/scripts/salt.sh
+++ b/day01-image/scripts/salt.sh
@@ -1,7 +1,7 @@
#!/bin/bash -xe
-FORMULA_VERSION=${FORMULA_VERSION:-2018.3.1}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
+MCP_VERSION=${MCP_VERSION:-proposed}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
SALT_OPTS="-t 10 --retcode-passthrough --no-color"
echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
@@ -33,17 +33,8 @@
salt-call ${SALT_OPTS} state.sls_id maas_cluster_packages maas
salt-call ${SALT_OPTS} state.sls_id maas_region_packages maas
-# FIXME move those into cluster model
-git clone https://github.com/Mirantis/docker-jenkins.git
-mkdir -p /srv/volumes/jenkins/userContent/theme/
-cp -r docker-jenkins/theme/* /srv/volumes/jenkins/userContent/theme/
-rm -rf docker-jenkins
-chown -R 1000:1000 /srv/volumes/jenkins/userContent/
-
-docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jenkins:${MCP_VERSION}"
-docker pull "docker-prod-local.artifactory.mirantis.com/mirantis/cicd/jnlp-slave:${MCP_VERSION}"
# Flag for cloud-init script
-touch /root/jenkins_in_docker
+touch /opt/jenkins_in_docker
# Duplicate of ubuntu_info.sh
mkdir -p /var/log/bootstrap_logs/ ; pushd /var/log/bootstrap_logs/
diff --git a/day01-image/template.json b/day01-image/template.json
index e7d90d3..741b7b6 100644
--- a/day01-image/template.json
+++ b/day01-image/template.json
@@ -10,7 +10,6 @@
"cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}",
"cluster_name": "{{ env `CLUSTER_NAME` }}",
"bs_hostname": "cfg01",
- "formula_version": "{{ env `FORMULA_VERSION` }}",
"mcp_version": "{{ env `MCP_VERSION` }}",
"ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
"saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
@@ -55,7 +54,6 @@
"CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
"CLUSTER_NAME={{ user `cluster_name` }}",
"BS_HOSTNAME={{ user `bs_hostname` }}",
- "FORMULA_VERSION={{ user `formula_version` }}",
"SALTSTACK_GPG={{ user `saltstack_gpg` }}",
"SALTSTACK_REPO={{ user `saltstack_repo` }}",
"APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
@@ -63,7 +61,6 @@
"GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
"APT_REPOSITORY={{ user `apt_repository` }}",
"APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}",
- "FORMULA_VERSION={{ user `formula_version` }}",
"APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
"BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh",
"MCP_VERSION={{ user `mcp_version` }}",
diff --git a/mirror-image/run.example.sh b/mirror-image/run.example.sh
index a27455a..acaea28 100755
--- a/mirror-image/run.example.sh
+++ b/mirror-image/run.example.sh
@@ -20,7 +20,6 @@
export CLUSTER_NAME="mcp-offline"
export MCP_VERSION="proposed"
-export FORMULA_VERSION="proposed"
BINARY_MCP_VERSION="proposed"
export UBUNTU_BASEURL="http://mirror.mirantis.com/${BINARY_MCP_VERSION}/ubuntu/"
diff --git a/mirror-image/scripts/mirrors.sh b/mirror-image/scripts/mirrors.sh
index 67cf90c..bdf686e 100644
--- a/mirror-image/scripts/mirrors.sh
+++ b/mirror-image/scripts/mirrors.sh
@@ -26,7 +26,7 @@
# Those would prevent failures for 2018q3+ model releases, where
# 'system.linux.system.repo.mcp.apt_mirantis.update.xxx' enabled by default
pushd /srv/volumes/aptly/public/
- CUR_V=$(salt-call pillar.get _param:apt_mk_version --out text | awk '{print $2}')
+ CUR_V=$(salt-call pillar.get _param:mcp_version --out text | awk '{print $2}')
mkdir -p update
ln -s ../${CUR_V} update/${CUR_V} || true
popd
diff --git a/mirror-image/template.json b/mirror-image/template.json
index dc62f90..3c13117 100644
--- a/mirror-image/template.json
+++ b/mirror-image/template.json
@@ -10,7 +10,6 @@
"cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}",
"cluster_name": "{{ env `CLUSTER_NAME` }}",
"bs_hostname": "apt01",
- "formula_version": "{{ env `FORMULA_VERSION` }}",
"mcp_version": "{{ env `MCP_VERSION` }}",
"ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
"saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
@@ -53,7 +52,6 @@
"CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
"CLUSTER_NAME={{ user `cluster_name` }}",
"BS_HOSTNAME={{ user `bs_hostname` }}",
- "FORMULA_VERSION={{ user `formula_version` }}",
"UBUNTU_BASEURL={{ user `ubuntu_baseurl` }}",
"SALTSTACK_GPG={{ user `saltstack_gpg` }}",
"SALTSTACK_REPO={{ user `saltstack_repo` }}",
diff --git a/trymcp-day01-image/run.example.sh b/trymcp-day01-image/run.example.sh
index ef02872..92ad386 100755
--- a/trymcp-day01-image/run.example.sh
+++ b/trymcp-day01-image/run.example.sh
@@ -20,7 +20,6 @@
export CLUSTER_MODEL="https://gerrit.mcp.mirantis.com/trymcp/drivetrain-model"
export CLUSTER_MODEL_REF="master"
export CLUSTER_NAME="try-mcp"
-export FORMULA_VERSION="proposed"
export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
export MCP_VERSION="proposed"
export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
diff --git a/trymcp-day01-image/scripts/salt.sh b/trymcp-day01-image/scripts/salt.sh
index ed696f4..2161aaf 100644
--- a/trymcp-day01-image/scripts/salt.sh
+++ b/trymcp-day01-image/scripts/salt.sh
@@ -1,7 +1,7 @@
#!/bin/bash -xe
-FORMULA_VERSION=${FORMULA_VERSION:-2018.3.1}
-APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $FORMULA_VERSION salt"}
+MCP_VERSION=${MCP_VERSION:-proposed}
+APT_MIRANTIS_SALT_REPO=${APT_MIRANTIS_SALT_REPO:-"http://apt.mirantis.com/xenial/ $MCP_VERSION salt"}
SALT_OPTS="-t 10 --retcode-passthrough --no-color"
echo "deb [arch=amd64] ${APT_MIRANTIS_SALT_REPO}" > /etc/apt/sources.list.d/mcp_salt.list
diff --git a/trymcp-day01-image/template.json b/trymcp-day01-image/template.json
index aa63016..84f0a8e 100644
--- a/trymcp-day01-image/template.json
+++ b/trymcp-day01-image/template.json
@@ -10,7 +10,6 @@
"cluster_model_ref": "{{ env `CLUSTER_MODEL_REF` }}",
"cluster_name": "{{ env `CLUSTER_NAME` }}",
"bs_hostname": "cfg01",
- "formula_version": "{{ env `FORMULA_VERSION` }}",
"mcp_version": "{{ env `MCP_VERSION` }}",
"ubuntu_baseurl": "{{ env `UBUNTU_BASEURL` }}",
"saltstack_gpg": "{{ env `SALTSTACK_GPG` }}",
@@ -54,7 +53,6 @@
"CLUSTER_MODEL_REF={{ user `cluster_model_ref` }}",
"CLUSTER_NAME={{ user `cluster_name` }}",
"BS_HOSTNAME={{ user `bs_hostname` }}",
- "FORMULA_VERSION={{ user `formula_version` }}",
"SALTSTACK_GPG={{ user `saltstack_gpg` }}",
"SALTSTACK_REPO={{ user `saltstack_repo` }}",
"APT_MIRANTIS_GPG={{ user `apt_mirantis_gpg` }}",
@@ -62,7 +60,6 @@
"GIT_SALT_FORMULAS_SCRIPTS={{ user `git_salt_formulas_scripts` }}",
"APT_REPOSITORY={{ user `apt_repository` }}",
"APT_REPOSITORY_GPG={{ user `apt_repository_gpg` }}",
- "FORMULA_VERSION={{ user `formula_version` }}",
"APT_MIRANTIS_SALT_REPO={{ user `apt_mirantis_salt_repo` }}",
"BOOTSTRAP_SALTSTACK_COM=file:///opt/bootstrap.saltstack.com.sh",
"MCP_VERSION={{ user `mcp_version` }}",