Commit 6ddacd25 authored by max's avatar max

pipeline cleanup

parent 8014f67b
......@@ -5,19 +5,39 @@ services:
variables:
CI_REGISTRY: "docker.io"
CI_IMAGE_PREFIX: "jriver"
stages:
- build
- test
- release
#####################
# CI Variables
#####################
# - CI_JRIVER_RELEASE=24/25
# Major Version of JRiver MediaCenter
#
# - CI_JRIVER_RELEASE_TAG=latest/stable
# Repository latest or stable
#
# - CI_IMAGE_PREFIX=jriver
# Some prefix for images that are built in the build stage and later used
#
# - CI_REGISTRY
# Docker registry to use
#
# - CI_REGISTRY_USER
# - CI_REGISTRY_PASSWORD
#####################
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
build:
stage: build
script:
- ./scripts/build.sh "$CI_JRIVER_RELEASE" "$CI_JRIVER_RELEASE_TAG"
- ./scripts-ci/build.sh
only:
- triggers
- schedules
......@@ -25,7 +45,7 @@ build:
test:
stage: test
script:
- ./scripts/test.sh "jrivermc$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG"
- ./scripts-ci/test.sh
only:
- triggers
- schedules
......@@ -33,7 +53,7 @@ test:
release:
stage: release
script:
- ./scripts/release.sh "jrivermc$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG" "$CI_JRIVER_RELEASE_TAG"
- ./scripts-ci/release.sh
only:
- triggers
- schedules
\ No newline at end of file
......@@ -9,7 +9,9 @@ if [ ! -d "./config" ]; then
fi
# Build image
docker build -t jrivertest --build-arg jriver_tag=stable .
docker build -t jrivertest \
--build-arg jriver_tag=latest \
--build-arg jriver_release=25 .
if [ "$1" == "-a" ]; then
# Run image mapping all ports
......
......@@ -5,22 +5,8 @@
#############
# NOTE: This script is intended to be run from the root of repo
if [ "$1" == "" ]; then
echo "JRiver release was not supplied. Exiting."
exit 1
else
JRIVER_MAJOR_RELEASE="$1"
fi;
if [ "$1" == "" ]; then
echo "JRiver tag was not supplied. Exiting."
exit 1
else
JRIVER_BUILD_TAG="$2"
fi;
docker build \
--no-cache --pull \
--build-arg jriver_tag=$JRIVER_BUILD_TAG \
--build-arg jriver_release=$JRIVER_MAJOR_RELEASE \
-t "jrivermc$JRIVER_MAJOR_RELEASE:$JRIVER_BUILD_TAG" .
\ No newline at end of file
--build-arg jriver_tag=$CI_JRIVER_RELEASE_TAG \
--build-arg jriver_release=$CI_JRIVER_RELEASE \
-t "$CI_IMAGE_PREFIX$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG" .
\ No newline at end of file
......@@ -5,22 +5,6 @@
#############
# NOTE: This script is intended to be run from the root of repo
# Name of the container that was built in the build stage
if [ "$1" == "" ]; then
echo "Container to release was not supplied. Exiting."
exit 1
else
IMAGE_TO_RELEASE="$1"
fi;
# Get input variables
if [ "$2" == "latest" ] || [ "$2" == "stable" ]; then
JRIVER_TARGET="$2"
else
echo "JRiver target (latest or stable) was not supplied."
exit 1
fi
# Version of the container
IMAGE_VERSION=$(cat rootfs/VERSION)
......@@ -40,7 +24,7 @@ function start_container() {
--name=$CONTAINER_NAME \
--net=bridge \
-p 52199:52199 \
"$IMAGE_TO_RELEASE"
"$CI_IMAGE_PREFIX$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG"
# Giving the container some time to start
sleep 60
......@@ -58,7 +42,7 @@ function determine_jriver_version() {
fi;
# Release tag in form of 25.0.50-stable-1
RELEASE_TAG="$JRIVER_VERSION-$JRIVER_TARGET-$IMAGE_VERSION"
RELEASE_TAG="$JRIVER_VERSION-$CI_JRIVER_RELEASE_TAG-$IMAGE_VERSION"
echo "RELEASE TAG: $RELEASE_TAG"
# Check if tag really is what's expected
......@@ -78,15 +62,15 @@ function push_versioned_container() {
echo "Image exists already. Skipping push."
else
echo "Image does not exist. Pushing versioned container."
docker tag "$IMAGE_TO_RELEASE" "$CI_REGISTRY_IMAGE_NAME:$RELEASE_TAG"
docker tag "$CI_IMAGE_PREFIX$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG" "$CI_REGISTRY_IMAGE_NAME:$RELEASE_TAG"
docker push "$CI_REGISTRY_IMAGE_NAME:$RELEASE_TAG"
fi;
}
function push_rolling_container() {
echo "Pushing rolling container."
docker tag "$IMAGE_TO_RELEASE" "$CI_REGISTRY_IMAGE_NAME:$JRIVER_TARGET"
docker push "$CI_REGISTRY_IMAGE_NAME:$JRIVER_TARGET"
docker tag "$CI_IMAGE_PREFIX$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG" "$CI_REGISTRY_IMAGE_NAME:$CI_JRIVER_RELEASE_TAG"
docker push "$CI_REGISTRY_IMAGE_NAME:$CI_JRIVER_RELEASE_TAG"
}
start_container
......
......@@ -4,13 +4,6 @@
# shiomax/jrivermc test script
#############
if [ "$1" == "" ]; then
echo "Container to test was not supplied. Exiting."
exit 1
else
TEST_TAG="$1"
fi;
CONTAINER_NAME="jriver_pipeline_test"
function cleanup() {
......@@ -26,7 +19,7 @@ function start_container() {
--name=$CONTAINER_NAME \
--net=bridge \
-p 52199:52199 \
"$TEST_TAG"
"$CI_IMAGE_PREFIX$CI_JRIVER_RELEASE:$CI_JRIVER_RELEASE_TAG"
# Giving the container some time to start
sleep 60
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment