Skip to content

Commit

Permalink
fix(google): Fixed codelab image construction (#1611)
Browse files Browse the repository at this point in the history
Moved codelab configuration script from pylib/spinnaker to google/codelab
since it isnt really part of the runtime.

Reintroduced first_codelab_boot because there are deployment-time
configurations needed.
  • Loading branch information
Eric Wiseblatt authored Apr 28, 2017
1 parent 749fff5 commit 0fb701d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 24 deletions.
12 changes: 0 additions & 12 deletions pylib/spinnaker/codelab_config.py → google/codelab/codelab_config.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ def configure_codelab_igor_jenkins(password):
}
)

def disable_destructive_action_challenge():
"""Disables destructive action challenge for codelab.
"""
with open('/opt/spinnaker/config/clouddriver-local.yml', 'w') as fd:
fd.write("""
'credentials': {
'challengeDestructiveActionsEnvironments': ''
}
"""


if __name__ == '__main__':
configure_codelab_igor_jenkins('admin')
disable_destructive_action_challenge()
28 changes: 28 additions & 0 deletions google/codelab/first_codelab_boot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PYTHONPATH=/opt/spinnaker/pylib python /opt/spinnaker/install/codelab_config.py
echo "debianRepository: http://$(hostname):9999/ trusty main" \
> /opt/spinnaker/config/rosco-local.yml
chown spinnaker:spinnaker /opt/spinnaker/config/rosco-local.yml

cat <<EOF > /opt/spinnaker/config/clouddriver-local.yml
credentials:
challengeDestructiveActionsEnvironments:
EOF
chown spinnaker:spinnaker /opt/spinnaker/config/clouddriver-local.yml

/opt/spinnaker/install/first_google_boot.sh
17 changes: 5 additions & 12 deletions google/codelab/provision_spinnaker_codelab_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# specifically for creating a new (running) codelab image out of a fresh
# spinnaker image.

set -e

if [[ `/usr/bin/id -u` -ne 0 ]]; then
echo "$0 must be executed with root permissions; exiting"
exit 1
Expand All @@ -30,10 +32,8 @@ if [[ ! -d "/opt/spinnaker/pylib" ]]; then
exit 1
fi

service spinnaker stop
service apache2 stop

set -e
service spinnaker stop || true
service apache2 stop || true

# this allows us to skip any interactive post-install configuration,
# specifically around keeping defaults for files that were modified.
Expand Down Expand Up @@ -74,6 +74,7 @@ sudo -u jenkins -H sh -c '/home/jenkins/aptly publish repo -architectures="amd64
cd /var/lib/jenkins
sudo -u jenkins -H sh -c 'wget https://storage.googleapis.com/codelab-jenkins-configuration/jenkins_dir.tar.gz'
sudo -u jenkins -H sh -c 'tar -zxvf jenkins_dir.tar.gz'
sudo -u jenkins -H sh -c 'rm jenkins_dir.tar.gz'
sudo -u jenkins -H sh -c 'git clone https://github.com/kenzanlabs/hello-karyon-rxnetty.git'
sudo -u jenkins -H sh -c 'cd /var/lib/jenkins/jobs/Hello-Build; rm -rf builds lastStable lastSuccessful scm-polling.log nextBuildNumber; echo 1 >> nextBuildNumber'

Expand All @@ -100,13 +101,5 @@ server {
EOF
service nginx restart

# configure nested properties in igor -- harder than a `sed` one-liner
PYTHONPATH=/opt/spinnaker/pylib python pylib/spinnaker/codelab_config.py
echo "debianRepository: http://$(hostname):9999/ trusty main" \
> /opt/spinnaker/config/rosco-local.yml

# Until we update the documentation and tutorials...
ln -s /opt/spinnaker/install/first_google_boot.sh /opt/spinnaker/install/first_codelab_boot.sh

service spinnaker restart
service apache2 restart

0 comments on commit 0fb701d

Please sign in to comment.