Skip to content

Commit 0c2c900

Browse files
committed
Create configuration for Composer version
1 parent ffc6766 commit 0c2c900

File tree

19 files changed

+86
-31
lines changed

19 files changed

+86
-31
lines changed

bin/ci/docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
66

7+
source "${ROOT_DIR}"/config/version/composer-version.env
78
source "${ROOT_DIR}"/config/docker/ci-docker-image-name.env
89

910
DOCKER_IMAGE_NAME="${CI_DOCKER_IMAGE_NAME}" \

bin/ci/env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,4 @@ set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
66

7-
source "${ROOT_DIR}"/bin/ci/dockerise.inc.bash
8-
97
"${ROOT_DIR}"/bin/composer install

bin/composer

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/..")"
66

7-
source "${ROOT_DIR}"/config/docker/ci-docker-image-name.env
7+
source "${ROOT_DIR}"/config/version/composer-version.env
8+
source "${ROOT_DIR}"/bin/docker-interactive-parameter.inc.bash
89

9-
BIN_DIR=bin \
10-
DOCKER_IMAGE_NAME="${CI_DOCKER_IMAGE_NAME}" \
11-
source "${ROOT_DIR}"/bin/dockerise.inc.bash
12-
13-
php7.4 /usr/local/bin/composer "${@}"
10+
docker \
11+
run \
12+
--rm \
13+
--tty \
14+
${DOCKER_INTERACTIVE_PARAMETER} \
15+
--volume "${ROOT_DIR}":/app \
16+
--user "$(id -u)":"$(id -g)" \
17+
--env COMPOSER_CACHE_DIR=/app/var/composer \
18+
composer:"${COMPOSER_VERSION}" \
19+
"${@}"

bin/docker-build.inc.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function buildDockerImage() {
2020
--tag "${dockerImageName}" \
2121
--build-arg DOCKER_UID="$(id -u)" \
2222
--build-arg DOCKER_GID="$(id -g)" \
23+
--build-arg COMPOSER_VERSION="${COMPOSER_VERSION}" \
2324
${refreshArguments} \
2425
${dockerBuildParams} \
2526
"${ROOT_DIR}"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
# Some terminals are not interactives, like GitLab CI for example
4+
5+
set -eu
6+
7+
set +e
8+
tty -s > /dev/null 2>&1 && isInteractiveShell=true || isInteractiveShell=false
9+
set -e
10+
if ${isInteractiveShell}; then
11+
readonly DOCKER_INTERACTIVE_PARAMETER="--interactive"
12+
else
13+
readonly DOCKER_INTERACTIVE_PARAMETER=
14+
fi

bin/dockerise.inc.bash

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,13 @@ else
99
fi
1010

1111
if ! ${isInDocker}; then
12-
set +e
13-
tty -s && isInteractiveShell=true || isInteractiveShell=false
14-
set -e
15-
16-
if ${isInteractiveShell}; then
17-
interactiveParameter="--interactive"
18-
else
19-
interactiveParameter=
20-
fi
12+
source "${ROOT_DIR}"/bin/docker-interactive-parameter.inc.bash
2113

2214
docker \
2315
run \
2416
--rm \
2517
--tty \
26-
${interactiveParameter} \
18+
${DOCKER_INTERACTIVE_PARAMETER} \
2719
--volume "${ROOT_DIR}":/app \
2820
--user "$(id -u)":"$(id -g)" \
2921
--entrypoint "${BIN_DIR}"/"$(basename "${0}")" \

bin/parallel-processes/docker

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
66

7-
source "${ROOT_DIR}"/config/repository/version.env
7+
source "${ROOT_DIR}"/config/version/composer-version.env
8+
source "${ROOT_DIR}"/config/version/repository-version.env
89
source "${ROOT_DIR}"/config/docker/parallel-processes-docker-image-name.env
910

1011
DOCKER_IMAGE_NAME="${PARALLEL_PROCESSES_DOCKER_IMAGE_NAME}" \

bin/release/docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
66

7+
source "${ROOT_DIR}"/config/version/composer-version.env
78
source "${ROOT_DIR}"/config/docker/release-docker-image-name.env
89

910
DOCKER_IMAGE_NAME="${RELEASE_DOCKER_IMAGE_NAME}" \

bin/release/env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
55

66
source "${ROOT_DIR}"/bin/release/dockerise.inc.bash
77

8-
"${ROOT_DIR}"/bin/composer install
8+
composer install

bin/release/prepare

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function updateRepositoryVersion() {
110110
trap onError ERR
111111

112112
echo "Edit REPOSITORY_VERSION"
113-
echo "REPOSITORY_VERSION=${NEW_REPOSITORY_VERSION}" > "${ROOT_DIR}"/config/repository/version.env
113+
echo "REPOSITORY_VERSION=${NEW_REPOSITORY_VERSION}" > "${ROOT_DIR}"/config/version/repository-version.env
114114
}
115115

116116
initLog

0 commit comments

Comments
 (0)