Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

#3 Want targets to build smartos images and releases

Also platform-smartos target no longer needed as targets.json target.
  • Loading branch information
nshalman authored and trentm committed Nov 26, 2014
1 parent 64f3157 commit 86b706f0416772d92fb1e555613a1c56bfd774f4
Showing with 146 additions and 1 deletion.
  1. +36 −0 Makefile
  2. +1 −1 targets.json.in
  3. +5 −0 tools/jenkins-build
  4. +19 −0 tools/smartos-index
  5. +85 −0 tools/smartos-release
@@ -2703,6 +2703,42 @@ clean_platform:
$(RM) -rf $(BITS_DIR)/platform
(cd build/smartos-live && gmake clean)

#---- smartos target

SMARTOS_BITS_DIR=$(BITS_DIR)/smartos

SMARTOS_BITS= \
$(SMARTOS_BITS_DIR)/changelog.txt \
$(SMARTOS_BITS_DIR)/SINGLE_USER_ROOT_PASSWORD.txt \
$(SMARTOS_BITS_DIR)/platform-$(TIMESTAMP).tgz \
$(SMARTOS_BITS_DIR)/smartos-$(TIMESTAMP).iso \
$(SMARTOS_BITS_DIR)/smartos-$(TIMESTAMP)-USB.img.bz2 \
$(SMARTOS_BITS_DIR)/smartos-$(TIMESTAMP).vmwarevm.tar.bz2

.PHONY: smartos
smartos: platform-smartos $(SMARTOS_BITS)

$(SMARTOS_BITS):
@echo "# Build smartos release: branch $(SMARTOS_LIVE_BRANCH), sha $(SMARTOS_LIVE_SHA), time `date -u +%Y%m%dT%H%M%SZ`"
(cd build/smartos-live \
&& ./tools/build_changelog \
&& ./tools/build_iso \
&& ./tools/build_usb \
&& ./tools/build_vmware)
mkdir -p $(SMARTOS_BITS_DIR)
cp build/smartos-live/output/changelog.txt $(SMARTOS_BITS_DIR)
cp build/smartos-live/output/platform-$(TIMESTAMP)/root.password $(SMARTOS_BITS_DIR)/SINGLE_USER_ROOT_PASSWORD.txt
cp build/smartos-live/output/platform-$(TIMESTAMP).tgz $(SMARTOS_BITS_DIR)
cp build/smartos-live/output-iso/platform-$(TIMESTAMP).iso $(SMARTOS_BITS_DIR)/smartos-$(TIMESTAMP).iso
cp build/smartos-live/output-usb/platform-$(TIMESTAMP).usb.bz2 $(SMARTOS_BITS_DIR)/smartos-$(TIMESTAMP)-USB.img.bz2
cp build/smartos-live/output-vmware/smartos-$(TIMESTAMP).vmwarevm.tar.bz2 $(SMARTOS_BITS_DIR)
(cd $(SMARTOS_BITS_DIR) && $(CURDIR)/tools/smartos-index $(TIMESTAMP) > index.html)
(cd $(SMARTOS_BITS_DIR) && /usr/bin/sum -x md5 * > md5sums.txt)

.PHONY: smartos-release
smartos-release:
TRACE=1 ./tools/smartos-release "$(BRANCH)" "$(TIMESTAMP)"

#---- docs target (based on eng.git/tools/mk code for this)

deps/%/.git:
@@ -1370,7 +1370,7 @@ cat <<EOF
"public": true,
"deps": []
},
"platform-smartos": {
"smartos": {
"repos": [
{"url": "git@github.com:joyent/smartos-live.git"},
{"url": "git@github.com:joyent/illumos-joyent.git"},
@@ -170,6 +170,11 @@ echo "#---------------------- upload"

cp $LOG bits/$JOB_NAME/
gmake manta_upload_jenkins

if [[ ${JOB_NAME} == "smartos" ]] && [[ ${BRANCH} == release* ]]; then
gmake smartos-release
fi

gmake jenkins_publish_image

now_time=$(date +%s)
@@ -0,0 +1,19 @@
#!/bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

#
# Copyright (c) 2014, Joyent, Inc.
#

echo "<html>"
echo "<head><title>SmartOS ${1}</title></head>"
echo "<body>"
for x in `ls * | grep -v index.html`; do
echo "<a href=\"$x\">$x</a><br>"
done
echo "<a href=\"md5sums.txt\">md5sums.txt</a>"
echo "</body></html>"
@@ -0,0 +1,85 @@
#!/bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

#
# Copyright (c) 2014, Joyent, Inc.
#

# Update the SmartOS release directory
if [ "$TRACE" != "" ]; then
export PS4='${BASH_SOURCE}:${LINENO}: '
set -o xtrace
fi
set -o errexit

TOP=$(cd $(dirname $0)/../; pwd)
BITS_DIR=bits/
PATH=$PATH:${TOP}/node_modules/manta/bin

# --- Manta config
if [[ -z "$MANTA_KEY_ID" ]]; then
export MANTA_KEY_ID=`ssh-keygen -l -f ~/.ssh/id_rsa.pub | awk '{print $2}' | tr -d '\n'`
fi
if [[ -z "$MANTA_URL" ]]; then
export MANTA_URL=https://us-east.manta.joyent.com
fi
if [[ -z "$MANTA_USER" ]]; then
export MANTA_USER="Joyent_Dev";
fi


function fatal {
echo "$(basename $0): error: $1"
exit 1
}

function errexit {
[[ $1 -ne 0 ]] || exit 0
fatal "error exit status $1 at line $2"
}

function print_help() {
echo "Usage:"
echo " ./tools/smartos-release BRANCH TIMESTAMP"
echo ""
echo "Create snaplinks under /\${MANTA_USER}/public/SmartOS/\${TIMESTAMP}"
echo "pointing to objects under /\${MANTA_USER}/public/builds/smartos/\${BRANCH}-\${TIMESTAMP}/smartos/"
}

trap 'errexit $? $LINENO' EXIT

BRANCH=$1
shift
TIMESTAMP=$1

SOURCE=/${MANTA_USER}/public/builds/smartos/${BRANCH}-${TIMESTAMP}/smartos/
SMARTOS=/${MANTA_USER}/public/SmartOS
DESTINATION=${SMARTOS}/${TIMESTAMP}

start_time=$(date +%s)
echo "Creating release snaplinks under ${DESTINATION}"

mmkdir -v -p ${DESTINATION}
mfind ${SOURCE} -t o | while read OBJECT; do
mln ${OBJECT} ${DESTINATION}/$(basename ${OBJECT})
done

echo "Updating top level ${SMARTOS} snaplinks"
mln ${SOURCE}/platform-${TIMESTAMP}.tgz ${SMARTOS}/platform-latest.tgz
mln ${SOURCE}/smartos-${TIMESTAMP}.iso ${SMARTOS}/smartos-latest.iso
mln ${SOURCE}/smartos-${TIMESTAMP}-USB.img.bz2 ${SMARTOS}/smartos-latest-USB.img.bz2
mln ${SOURCE}/smartos-${TIMESTAMP}.vmwarevm.tar.bz2 ${SMARTOS}/smartos-latest.vmwarevm.tar.bz2

echo "Updating ${SMARTOS}/latest object"
echo ${DESTINATION} | mput -v -H 'content-type: text/plain' ${SMARTOS}/latest

echo "<html><head><meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=${SOURCE}/index.html\"></head></html>" | mput -H 'content-type: text/html' ${SMARTOS}/latest.html

end_time=$(date +%s)
elapsed=$((${end_time} - ${start_time}))
echo "Creating release snaplinks took ${elapsed} seconds (Manta path=${DESTINATION})"
exit 0

0 comments on commit 86b706f

Please sign in to comment.
You can’t perform that action at this time.