mirror of
https://github.com/fsquillace/junest.git
synced 2026-01-23 02:34:30 +00:00
Add deploy feature
This commit is contained in:
parent
b75faac48f
commit
9d2e6e4bbf
5 changed files with 75 additions and 18 deletions
31
.travis.yml
31
.travis.yml
|
|
@ -15,7 +15,6 @@ archlinux:
|
|||
- ~/.pkg-cache:/var/cache/pacman/pkg
|
||||
packages:
|
||||
# Pacman packages
|
||||
- aws-cli
|
||||
- ccache
|
||||
- git
|
||||
- haveged
|
||||
|
|
@ -34,14 +33,23 @@ archlinux:
|
|||
sudo sed -i '$a CFLAGS="$CFLAGS -w"' /etc/makepkg.conf
|
||||
sudo sed -i '$a CXXFLAGS="$CXXFLAGS -w"' /etc/makepkg.conf
|
||||
script:
|
||||
# Here do not make any validation (-n) because it will be done later on in the Ubuntu host directly
|
||||
- ./bin/junest build -n
|
||||
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- TRAVIS_BASH_VERSION="4.0"
|
||||
global:
|
||||
# AWS_ACCESS_KEY_ID
|
||||
- secure: "ZotyKKWH5ZrBXDdEnVmV22gbn86BBSiqDZn2d2jVAApgUQdDc3wa7/uYAZP1bts6oQ897nnkUSFHk3M3QAcIoPJerUITTU5D7yjKcFDejgHdpJ4t9XSajmpY9CgKftWapwliWG4wolAKwyAp5GnYqz4GGltHyGxbF/VzUNRF3lw="
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
- secure: "AWixvJmhr6+rfF4cspMWMjkvLuOsdfNanLK5wrqkgx/0ezDGBBThH0qVhn5Mp1QFM6wVF+LRA6UESNnj0wNwByZHdM6LddkJWlWHb/qkVK+AO4RKUsXJWNyPyOkCNj/WEFpZHQKKUAlEtC8m8AmAcuoi90cr6ih0PXIePRyPFrM="
|
||||
|
||||
before_install:
|
||||
- ./tests/integ-tests/install-bash.sh "$TRAVIS_BASH_VERSION"
|
||||
- ./ci/install-bash.sh "$TRAVIS_BASH_VERSION"
|
||||
- sudo apt-get update
|
||||
- sudo apt-get -y install awscli
|
||||
|
||||
install:
|
||||
- PATH=$PWD/bin:$PATH
|
||||
|
|
@ -56,28 +64,27 @@ script:
|
|||
|
||||
# ARM with qemu does seem to work properly. Disabling integ tests for ARM for now.
|
||||
#- export JUNEST_HOME=~/.junest-arm
|
||||
#- junest setup --arch arm
|
||||
#- junest proot --fakeroot -- echo "Installing JuNest (\$(uname -m))"
|
||||
#- junest proot --fakeroot -- ${PWD}/lib/checks/check.sh --skip-aur-tests
|
||||
#- junest proot -- ${PWD}/lib/checks/check.sh --skip-aur-tests --use-sudo
|
||||
#- yes | junest setup --delete
|
||||
|
||||
#######################
|
||||
# Build and validation tests
|
||||
# Build and validation
|
||||
#######################
|
||||
- "curl -s https://raw.githubusercontent.com/bartoszek/arch-travis/master/arch-travis.sh | bash"
|
||||
- "echo pacman pkg cache size: $(du -h ~/.pkg-cache|cut -f1) in $(ls ~/.pkg-cache|wc -l) files"
|
||||
- ls -l
|
||||
- pwd
|
||||
|
||||
# TODO Test the new created JuNest image against Ubuntu host
|
||||
#- junest setup
|
||||
#- junest -- echo "Installing JuNest (\$(uname -m))"
|
||||
#- JUNEST_HOME=~/.junest-arm junest setup --arch arm
|
||||
#- JUNEST_HOME=~/.junest-arm junest proot --fakeroot -- echo "Installing JuNest (\$(uname -m))"
|
||||
# Test the newly created JuNest image against Ubuntu host
|
||||
- export JUNEST_HOME=~/.junest
|
||||
- junest setup -i junest-x86_64.tar.gz
|
||||
- ${PWD}/lib/checks/check_all.sh
|
||||
- yes | junest setup --delete
|
||||
|
||||
# TODO test deployed image can be downloaded correctly
|
||||
|
||||
|
||||
after_success:
|
||||
#######################
|
||||
# Deploy and validation
|
||||
#######################
|
||||
- ./ci/deploy.sh ${PWD}/junest-x86_64.tar.gz
|
||||
|
|
|
|||
50
ci/deploy.sh
Executable file
50
ci/deploy.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
IMG_PATH=$1
|
||||
|
||||
set -u
|
||||
|
||||
MAX_OLD_IMAGES=30
|
||||
|
||||
# ARCH can be one of: x86, x86_64, arm
|
||||
HOST_ARCH=$(uname -m)
|
||||
if [ $HOST_ARCH == "i686" ] || [ $HOST_ARCH == "i386" ]
|
||||
then
|
||||
ARCH="x86"
|
||||
elif [ $HOST_ARCH == "x86_64" ]
|
||||
then
|
||||
ARCH="x86_64"
|
||||
elif [[ $HOST_ARCH =~ .*(arm).* ]]
|
||||
then
|
||||
ARCH="arm"
|
||||
else
|
||||
echo "Unknown architecture ${HOST_ARCH}" >&2
|
||||
exit 11
|
||||
fi
|
||||
|
||||
if [[ "$TRAVIS_BRANCH" == "master" ]]
|
||||
then
|
||||
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
# Upload image
|
||||
# The put is done via a temporary filename in order to prevent outage on the
|
||||
# production file for a longer period of time.
|
||||
cp ${IMG_PATH} ${IMG_PATH}.temp
|
||||
aws s3 cp ${IMG_PATH}.temp s3://junest-repo/junest/
|
||||
aws s3 mv s3://junest-repo/junest/${IMG_PATH}.temp s3://junest-repo/junest/${IMG_PATH}
|
||||
aws s3api put-object-acl --acl public-read --bucket junest-repo --key junest/${IMG_PATH}
|
||||
|
||||
DATE=$(date +'%Y-%m-%d-%H-%M-%S')
|
||||
|
||||
aws s3 cp ${IMG_PATH} s3://junest-repo/junest/${IMG_PATH}.${DATE}
|
||||
|
||||
# Cleanup old images
|
||||
aws s3 ls s3://junest-repo/junest/junest-${ARCH}.tar.gz. | awk '{print $4}' | head -n -${MAX_OLD_IMAGES} | xargs -I {} s3 rm "s3://junest-repo/junest/{}"
|
||||
|
||||
# Test the newly deployed image can be downloaded correctly
|
||||
junest setup
|
||||
junest -- echo "Installed JuNest (\$(uname -m))"
|
||||
yes | junest setup --delete
|
||||
fi
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#
|
||||
# vim: ft=sh
|
||||
|
||||
set -e
|
||||
set -ex
|
||||
|
||||
|
||||
RUN_ROOT_TESTS=false
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ JUNEST_SCRIPT=${JUNEST_SCRIPT:-${JUNEST_BASE}/bin/junest}
|
|||
|
||||
CHECK_SCRIPT=${JUNEST_BASE}/lib/checks/check.sh
|
||||
|
||||
$JUNEST_SCRIPT proot --fakeroot --backend-args "-b ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --skip-aur-tests
|
||||
$JUNEST_SCRIPT proot --backend-args "-b ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --skip-aur-tests --use-sudo
|
||||
$JUNEST_SCRIPT ns --backend-args "--bind ${JUNEST_BASE} ${JUNEST_BASE}" --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests
|
||||
$JUNEST_SCRIPT ns --backend-args "--bind ${JUNEST_BASE} ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --use-sudo
|
||||
sudo -E $JUNEST_SCRIPT groot --backend-args "--bind ${JUNEST_BASE}" -- "$CHECK_SCRIPT" --run-root-tests --skip-aur-tests
|
||||
$JUNEST_SCRIPT proot --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests
|
||||
$JUNEST_SCRIPT proot -- "$CHECK_SCRIPT" --skip-aur-tests --use-sudo
|
||||
$JUNEST_SCRIPT ns --fakeroot -- "$CHECK_SCRIPT" --skip-aur-tests
|
||||
$JUNEST_SCRIPT ns -- "$CHECK_SCRIPT" --use-sudo
|
||||
sudo -E $JUNEST_SCRIPT groot -- "$CHECK_SCRIPT" --run-root-tests --skip-aur-tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue