Added Repo Tests

Added ./docker/test_dockers.bsh in order to test if the repo files
are working.
Got REPO_HOSTNAME env variable working for centos and debian
Standardized the archive filename for git-lfs.spec
This commit is contained in:
Andy Neff 2015-07-19 03:35:13 -04:00
parent 68b29afe52
commit bb21163b45
12 changed files with 123 additions and 40 deletions

@ -80,6 +80,10 @@ Cleans the copies, so all untracked files are deleted, but uncommited changes ar
gpg --key-gen
### Testing the Repositories ###
./test_dockers.bsh
## Adding addition OSes ##
To add another operating system, simply follow the already existing pattern,

@ -14,8 +14,8 @@ cd "${GIT_LFS_BUILD_DIR}"
git clean -xdf . || ./rpm/clean.bsh #clean is needed when git isn't alread installed
"${GIT_LFS_BUILD_DIR}"/rpm/build_rpms.bsh
if [ "${RPM_REPO_HOSTNAME-}" == "" ]; then
sed -ir 's/(^baseurl=https?:\/\/)[^/]*/\1'"${RPM_REPO_HOSTNAME}"'/' ../rpm/SOURCES/git-lfs.repo
if [ "${REPO_HOSTNAME-}" != "" ]; then
sed -r -i 's/(^baseurl=https?:\/\/)[^/]*/\1'"${REPO_HOSTNAME}"'/' ./rpm/SOURCES/git-lfs.repo
fi
rpmbuild --define "_topdir ${GIT_LFS_BUILD_DIR}/rpm" -ba ${GIT_LFS_BUILD_DIR}/rpm/SPECS/git-lfs-repo-release.spec

@ -13,6 +13,12 @@ cp -r -T "${SRC_DIR}" "${GIT_LFS_BUILD_DIR}"
cd "${GIT_LFS_BUILD_DIR}"
git clean -xdf .
if [ "${REPO_HOSTNAME-}" == "" ]; then
#TOOD: Finish this when the git-lfs-repo is done
echo 'deb http://${REPO_HOSTNAME:-git-lfs.github.com}/debian/8 jessie main' > /tmp/git-lfs-main.list
#/etc/apt/sources.list.d/git-lfs-main.list
fi
mkdir -p "${REPO_DIR}/conf/"
sed 's|^Codename:.*|Codename: '${REPO_CODENAME}'|' /tmp/distributions > "${REPO_DIR}/conf/distributions"
if [ -s /tmp/signing.key ]; then

@ -0,0 +1,13 @@
FROM centos:7
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
#Docker RUN example, pass in the git-lfs checkout copy you are working with
LABEL RUN="docker run -v git-lfs-repo-dir:/src" -v repo_dir:/repo"
ADD test_lfs.bsh /tmp/test_lfs.bsh
CMD yum install -y --nogpgcheck http://${REPO_HOSTNAME:-git-lfs.github.com}/centos/7/RPMS/noarch/git-lfs-repo-release-1-1.el7.centos.noarch.rpm && \
yum install -y git-lfs && \
git-lfs && \
yum install -y perl-Digest-SHA golang && \
/tmp/test_lfs.bsh

@ -0,0 +1,19 @@
FROM debian:jessie
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
#Docker RUN example, pass in the git-lfs checkout copy you are working with
LABEL RUN="docker run -v git-lfs-checkout-dir:/src"
ADD test_lfs.bsh /tmp/test_lfs.bsh
#TODO: Needs to be replaced by an apt repo
ADD public.key /etc/apt/trusted.gpg.d/git-lfs.gpg
ADD git-lfs-main_8.list /etc/apt/sources.list.d/git-lfs-main.list
#These SHOULD be throw away commands, and not stored as Docker commits
CMD DEBIAN_FRONTEND=noninteractive \
apt-get -y update && \
apt-get install -y git-lfs && \
git lfs && \
apt-get install -y golang curl && \
/tmp/test_lfs.bsh

@ -3,13 +3,20 @@
# Usage:
# ./run_dockers.bsh - Run all the docker images
# ./run_dockers.bsh lfs_centos_5 lfs_centos_7 - Run only CentOS 5 & 7 image
# ./run_dockers.bsh lfs_centos_6 -- bash #Runs bash in the CentOS 6 docker
#
# Special Environmet Variables
# REPO_HOSTNAME - Override the hostname for all the repos generated/tested
# BUILD_LOCAL - Set to 1 (default) to use the current checkout version of
# git-lfs to build against. Else the released archived is
# downloaded and built against.
# Currently only works for RPMs. DEB always builds the current
# checkout version
set -eu
CUR_DIR=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
REPO_DIR=$(cd ${CUR_DIR}/..; pwd)
PACKAGE_DIR=${CUR_DIR}/repos
BUILD_LOCAL=1
#If you are not in docker group and you have sudo, default value is sudo
: ${SUDO=`if id -nG | grep -qwv docker && which sudo > /dev/null 2>&1; then echo sudo; fi`}
@ -27,6 +34,7 @@ function split_image_name()
IMAGE_INFO=(${IMAGE_NAME})
}
# Parse Arguments
IMAGES=()
while [[ $# > 0 ]]; do
if [ "$1" == "--" ]; then
@ -48,18 +56,28 @@ mkdir -p "${PACKAGE_DIR}"
for DOCKER_FILE in "${IMAGES[@]}"; do
split_image_name "${DOCKER_FILE}" #set IMAGE_NAME and IMAGE_INFO
#TODO REMOVE THIS AFTER THE REAL git-lfs-repo packages
if [ "${IMAGE_INFO[1]}" == "debian" ]; then
if [ "${IMAGE_INFO[2]}" == "7" ]; then
echo "deb http://${REPO_HOSTNAME:-git-lfs.github.com}/debian/7 wheezy main" > ${CUR_DIR}/git-lfs-main_7.list
elif [ "${IMAGE_INFO[2]}" == "8" ]; then
echo "deb http://${REPO_HOSTNAME:-git-lfs.github.com}/debian/8 jessie main" > ${CUR_DIR}/git-lfs-main_8.list
fi
fi
#END TODO
#Auto build docker unless DOCKER_AUTOBUILD=0
if [[ ${DOCKER_AUTOBUILD-1} != 0 ]]; then
${CUR_DIR}/build_dockers.bsh ${DOCKER_FILE}
fi
echo Compiling LFS in docker image ${IMAGE_NAME}
IMAGE_REPO_DIR="${PACKAGE_DIR}"/"${IMAGE_INFO[1]}"/"${IMAGE_INFO[2]}"
$SUDO docker run --rm ${DOCKER_CMD+-it} \
-e BUILD_LOCAL=${BUILD_LOCAL} \
-e BUILD_LOCAL=${BUILD_LOCAL-1} \
-e REPO_HOSTNAME=${REPO_HOSTNAME:-git-lfs.github.com} \
-v ${REPO_DIR}:/src \
-v ${IMAGE_REPO_DIR}:/repo \
--name git-lfs_build_container \
${IMAGE_NAME} ${DOCKER_CMD-}
#mkdir -p "${IMAGE_REPO_DIR}"
#$SUDO docker cp git-lfs_build_container:/tmp/docker_run/repo/ ${IMAGE_REPO_DIR}
# $SUDO docker kill git-lfs_build_container
# $SUDO docker rm git-lfs_build_container
done

9
docker/test_dockers.bsh Executable file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -eu
#Test to see is using the repo installs really work
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
${CUR_DIR}/run_dockers.bsh $(ls -d ${CUR_DIR}/git-lfs-test_*/) "${@}"

11
docker/test_lfs.bsh Executable file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -eu
cp -ra /src /tmp/test/
cd /tmp/test
mkdir -p ./src/github.com/github
unlink src/github.com/github/git-lfs || :
ln -sf $(pwd) src/github.com/github/git-lfs
LFS_BIN=1 GOPATH=$(pwd) ./script/test
LFS_BIN=1 ./script/integration

@ -6,7 +6,7 @@ Summary: Git extension for versioning large files
Group: Applications/Archiving
License: MIT
URL: https://git-lfs.github.com/
Source0: https://github.com/github/git-lfs/archive/v%{version}.tar.gz
Source0: https://github.com/github/git-lfs/archive/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: golang, tar, which, bison, rubygem-ronn, git
BuildRequires: perl-Digest-SHA
@ -68,5 +68,8 @@ rm -rf %{buildroot}
/usr/share/man/man1/*.1.gz
%changelog
* Sat Jul 18 2015 Andrew Neff <andyneff@users.noreply.github.com> - 0.5.2-1
- Changed Source0 filename
* Mon May 18 2015 Andrew Neff <andyneff@users.noreply.github.com> - 0.5.1-1
- Initial Spec

@ -62,33 +62,31 @@ if ( [[ ${GIT_VERSION[0]} == 1 ]] && [[ ${GIT_VERSION[1]} < 8 ]] ) || [[ ${GIT_V
fi
fi
if [ ! -e ${CURDIR}/SOURCES/v${VERSION}.tar.gz ]; then
if [ "${BUILD_LOCAL:=0}" == "1" ]; then
#Prep the SOURCES dir for git-lfs
if [ "${BUILD_LOCAL:=0}" == "1" ]; then
echo "Zipping up current checkout of git-lfs..." >&6
if [[ ${REDHAT_VERSION} == 5 ]]; then
rm -rvf ${CURDIR}/tmptar
mkdir -p ${CURDIR}/tmptar/git-lfs-${VERSION}
pushd ${CURDIR}/..
tar -c . --exclude rpm --exclude .git --exclude tmptar | tar -x -C ${CURDIR}/tmptar/git-lfs-${VERSION}/
tar -c . --exclude tmptar | tar -x -C ${CURDIR}/tmptar/git-lfs-${VERSION}/
popd
pushd ${CURDIR}/tmptar
tar -zcf ${CURDIR}/SOURCES/v${VERSION}.tar.gz git-lfs-${VERSION}
git clean -xdf
rm -rvf ${CURDIR}/tmptar/.git
tar -zcf ${CURDIR}/SOURCES/git-lfs-${VERSION}.tar.gz git-lfs-${VERSION}
popd
rm -rvf ${CURDIR}/tmptar
else
pushd ${CURDIR}/..
tar -zcf ${CURDIR}/SOURCES/v${VERSION}.tar.gz --exclude v${VERSION}.tar.gz --exclude .git --exclude rpm . --transform "s:^:git-lfs-${VERSION}/:"
popd
fi
else
else
echo "Downloading git-lfs..." >&6
mkdir -p ${CURDIR}/SOURCES
pushd ${CURDIR}/SOURCES
curl -L -O https://github.com/github/git-lfs/archive/v${VERSION}.tar.gz
curl -L -o git-lfs-${VERSION}.tar.gz https://github.com/github/git-lfs/archive/v${VERSION}.tar.gz
popd
fi
fi
cp ${CURDIR}/../docker/public.key ${CURDIR}/SOURCES/RPM-GPG-KEY-GITLFS
if ! which go; then
echo "Installing go... one way or another" >&6
if [[ ${REDHAT_VERSION[0]} == 5 ]]; then
@ -153,6 +151,7 @@ fi
echo "Build git-lfs rpm..." >&6
sed -i 's|\(Version:\s*\).*|\1'"${VERSION}"'|' ${CURDIR}/SPECS/git-lfs.spec
cp ${CURDIR}/../docker/public.key ${CURDIR}/SOURCES/
"${RPMBUILD[@]}" -ba ${CURDIR}/SPECS/git-lfs.spec
#if [ "`stat -c '%U' ${CURDIR}/SPECS/git-lfs.spec`" == "UNKNOWN" ]; then
# $SUDO cp ${CURDIR}/SPECS/git-lfs.spec ${CURDIR}/SPECS/git-lfs2.spec

@ -4,7 +4,8 @@ set -eu
CWD=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
rm -rv ${CWD}/BUILD ${CWD}/BUILDROOT ${CWD}/RPMS ${CWD}/SRPMS ${CWD}/SOURCES || :
rm -rv ${CWD}/BUILD ${CWD}/BUILDROOT ${CWD}/RPMS ${CWD}/SRPMS || :
find ${CWD}/SOURCES -not -name git-lfs.repo
rm ${CWD}/SPECS/golang.spec || :