Always use standalone docker-compose in Jenkins CI
Avoid docker compose subcommand (not in static docker CLI). Cache binaries in .ci-bin and drop duplicate checkout stage.
This commit is contained in:
parent
2ed6c611cb
commit
752f6da269
1 changed files with 12 additions and 16 deletions
28
Jenkinsfile
vendored
28
Jenkinsfile
vendored
|
|
@ -7,12 +7,6 @@ pipeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout') {
|
|
||||||
steps {
|
|
||||||
checkout scm
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Production readiness') {
|
stage('Production readiness') {
|
||||||
steps {
|
steps {
|
||||||
sh 'chmod +x scripts/ci/*.sh'
|
sh 'chmod +x scripts/ci/*.sh'
|
||||||
|
|
@ -25,27 +19,29 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
sh '''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
mkdir -p .ci-bin
|
mkdir -p .ci-bin dist
|
||||||
if ! command -v docker >/dev/null 2>&1; then
|
|
||||||
|
if [ ! -x .ci-bin/docker ]; then
|
||||||
echo "Installing static docker CLI..."
|
echo "Installing static docker CLI..."
|
||||||
curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-27.4.1.tgz" \
|
curl -fsSL "https://download.docker.com/linux/static/stable/x86_64/docker-27.4.1.tgz" \
|
||||||
| tar xz --strip-components=1 -C .ci-bin docker/docker
|
| tar xz --strip-components=1 -C .ci-bin docker/docker
|
||||||
chmod +x .ci-bin/docker
|
chmod +x .ci-bin/docker
|
||||||
fi
|
fi
|
||||||
if ! command -v docker-compose >/dev/null 2>&1 && ! docker compose version >/dev/null 2>&1; then
|
|
||||||
echo "Installing docker-compose plugin binary..."
|
if [ ! -x .ci-bin/docker-compose ]; then
|
||||||
|
echo "Installing docker-compose binary..."
|
||||||
curl -fsSL "https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-linux-x86_64" \
|
curl -fsSL "https://github.com/docker/compose/releases/download/v2.32.4/docker-compose-linux-x86_64" \
|
||||||
-o .ci-bin/docker-compose
|
-o .ci-bin/docker-compose
|
||||||
chmod +x .ci-bin/docker-compose
|
chmod +x .ci-bin/docker-compose
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PATH="$PWD/.ci-bin:$PATH"
|
export PATH="$PWD/.ci-bin:$PATH"
|
||||||
COMPOSE="docker compose"
|
docker version
|
||||||
if ! docker compose version >/dev/null 2>&1; then
|
docker-compose version
|
||||||
COMPOSE="docker-compose"
|
|
||||||
fi
|
|
||||||
mkdir -p dist
|
|
||||||
sed '/exclude_from_hc:/d' docker-compose.yml > dist/docker-compose.coolify.yml
|
sed '/exclude_from_hc:/d' docker-compose.yml > dist/docker-compose.coolify.yml
|
||||||
$COMPOSE -f dist/docker-compose.coolify.yml config -q
|
docker-compose -f dist/docker-compose.coolify.yml config -q
|
||||||
|
|
||||||
VERSION="$(grep -E '^ERPNEXT_VERSION=' example.env | cut -d= -f2)"
|
VERSION="$(grep -E '^ERPNEXT_VERSION=' example.env | cut -d= -f2)"
|
||||||
docker pull "frappe/erpnext:${VERSION}"
|
docker pull "frappe/erpnext:${VERSION}"
|
||||||
echo "frappe/erpnext:${VERSION} OK"
|
echo "frappe/erpnext:${VERSION} OK"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue