diff --git a/Dockerfile b/Dockerfile index 407b216..0459ab9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ # Copyright 2016, EMC, Inc. -FROM rackhd/on-core:devel +ARG repo=rackhd +ARG tag=devel + +FROM ${repo}/on-core:${tag} COPY . /RackHD/on-tftp/ WORKDIR /RackHD/on-tftp diff --git a/HWIMO-BUILD b/HWIMO-BUILD index e0e455e..c922bfb 100755 --- a/HWIMO-BUILD +++ b/HWIMO-BUILD @@ -15,11 +15,10 @@ set -e set -x rm -rf packagebuild -git clone . packagebuild +rsync -L -r . packagebuild pushd packagebuild cp ../package.json . -rm -rf node_modules npm install --cache=`pwd` npm prune --production git log -n 1 --pretty=format:%h.%ai.%s > commitstring.txt diff --git a/alpha/build_deb.sh b/alpha/build_deb.sh new file mode 100755 index 0000000..a883b6c --- /dev/null +++ b/alpha/build_deb.sh @@ -0,0 +1,8 @@ +#!/bin/bash -ex + +./alpha/set_dependencies.sh + +./HWIMO-BUILD +pwd +ls -l +cp *.deb ../build diff --git a/alpha/build_deb.yml b/alpha/build_deb.yml new file mode 100644 index 0000000..a344e20 --- /dev/null +++ b/alpha/build_deb.yml @@ -0,0 +1,13 @@ +--- +platform: linux + +inputs: +- name: on-tftp +- name: on-core +- name: manifest-artifactory +outputs: +- name: build + +run: + path: "alpha/build_deb.sh" + dir: "on-tftp" diff --git a/alpha/build_docker.sh b/alpha/build_docker.sh new file mode 100755 index 0000000..acfb31d --- /dev/null +++ b/alpha/build_docker.sh @@ -0,0 +1,12 @@ +#!/bin/bash -ex + +if [ "${VERIFY_DEP}" == "true" ]; then + COMMIT=$(cat $(ls ../manifest-artifactory/manifest*.json) | jq -r .ontftp.commit) + git config --add remote.origin.fetch +refs/pull/*/head:refs/remotes/origin/pull/* + git fetch + git checkout $COMMIT + export ONCORE_TAG=$(<../on-core-docker/digest) + sed -i "s/^FROM.*/FROM $REGISTRY\/${REPO_OWNER}\/on-core@${ONCORE_TAG}/" ./Dockerfile +fi +cat Dockerfile +cp -rf * ../build diff --git a/alpha/build_docker.yml b/alpha/build_docker.yml new file mode 100644 index 0000000..93b0bd7 --- /dev/null +++ b/alpha/build_docker.yml @@ -0,0 +1,13 @@ +--- +platform: linux + +inputs: +- name: on-tftp +- name: manifest-artifactory +- name: on-core-docker +outputs: +- name: build + +run: + path: "alpha/build_docker.sh" + dir: "on-tftp" diff --git a/alpha/post_build_deb.yml b/alpha/post_build_deb.yml new file mode 100644 index 0000000..2661d46 --- /dev/null +++ b/alpha/post_build_deb.yml @@ -0,0 +1,11 @@ +--- +platform: linux + +inputs: +- name: on-tftp +outputs: +- name: build + +run: + path: "alpha/build_deb.sh" + dir: "on-tftp" diff --git a/alpha/post_unittest.yml b/alpha/post_unittest.yml new file mode 100644 index 0000000..e484f1d --- /dev/null +++ b/alpha/post_unittest.yml @@ -0,0 +1,8 @@ +--- +platform: linux + +inputs: +- name: on-tftp +run: + path: "alpha/unittest.sh" + dir: "on-tftp" diff --git a/alpha/set_dependencies.sh b/alpha/set_dependencies.sh new file mode 100755 index 0000000..d0aaacb --- /dev/null +++ b/alpha/set_dependencies.sh @@ -0,0 +1,26 @@ +#!/bin/bash -ex + +if [ "${VERIFY_DEP}" == "true" ]; then + COMMIT=$(cat $(ls ../manifest-artifactory/manifest*.json) | jq -r .ontftp.commit) + git config --add remote.origin.fetch +refs/pull/*/head:refs/remotes/origin/pull/* + git fetch + git checkout $COMMIT + pushd ../on-core + COMMIT=$(cat $(ls ../manifest-artifactory/manifest*.json) | jq -r .oncore.commit) + git config --add remote.origin.fetch +refs/pull/*/head:refs/remotes/origin/pull/* + git fetch + git checkout $COMMIT + rm -rf .git + popd + mkdir -p node_modules + + # Map on-core + pushd ../ + ln -s $(pwd)/on-core $(pwd)/on-tftp/node_modules/on-core + popd + + # Run npm install for on-core + pushd ../on-core + npm install + popd +fi diff --git a/alpha/unittest.sh b/alpha/unittest.sh new file mode 100755 index 0000000..af8c4bd --- /dev/null +++ b/alpha/unittest.sh @@ -0,0 +1,7 @@ +#!/bin/sh -ex +./alpha/set_dependencies.sh +ps -aux +service rabbitmq-server start +/usr/bin/mongod --fork --logpath /var/log/mongodb/monngod.log +npm install +./node_modules/.bin/_mocha $(find spec -name '*-spec.js') --timeout 10000 --require spec/helper.js diff --git a/alpha/unittest.yml b/alpha/unittest.yml new file mode 100644 index 0000000..67419c8 --- /dev/null +++ b/alpha/unittest.yml @@ -0,0 +1,10 @@ +--- +platform: linux + +inputs: +- name: on-tftp +- name: on-core +- name: manifest-artifactory +run: + path: "alpha/unittest.sh" + dir: "on-tftp"