Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CoTA
cota-backend
Commits
75d46d80
Commit
75d46d80
authored
Oct 12, 2025
by
Abhishek
Browse files
Update .gitlab-ci.yml file
parent
021c4df0
Pipeline
#11988
failed with stages
in 16 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
75d46d80
...
@@ -5,57 +5,44 @@
...
@@ -5,57 +5,44 @@
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
image
:
eclipse-temurin:21-jdk
services
:
-
docker:20.10.16-dind
stages
:
stages
:
-
build
-
build
-
docker
-
docker
variables
:
variables
:
DOCKER_HOST
:
tcp://docker:2375
BUILD_NUMBER
:
"
${CI_PIPELINE_ID:-1}"
DOCKER_TLS_CERTDIR
:
"
"
DOCKER_IMAGE
:
"
cota-backend"
DOCKER_IMAGE
:
hftstuttgart/cota-backend
DOCKER_TAG
:
"
test"
DOCKER_TAG
:
test
BUILD_NUMBER
:
"
$CI_PIPELINE_ID"
before_script
:
-
echo "🔍 Checking Docker setup..."
-
apt-get update && apt-get install -y maven curl jq git
-
docker version
-
until docker info > /dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 3; done
-
echo "🧱 Maven and Java versions:"
-
mvn -v
-
java -version
# ----------------------------
# Stage 1: Build Maven project
# ----------------------------
build_backend
:
build_backend
:
image
:
maven:3.9.9-eclipse-temurin-17
stage
:
build
stage
:
build
script
:
script
:
-
echo "
⚙️
Building backend with Maven..."
-
echo "
🔧
Building backend
JAR
with Maven..."
-
mvn clean install
-DskipTests=true -B
-
mvn
-B
clean install
-
echo "✅ Maven build
complete. JARs generated in target/
."
-
echo "✅ Maven build
done
."
artifacts
:
artifacts
:
paths
:
paths
:
-
target/*.jar
-
target/*.jar
expire_in
:
1 hour
expire_in
:
1 hour
# ----------------------------
# Stage 2: Build Docker image (no push)
# ----------------------------
docker_build_test
:
docker_build_test
:
image
:
docker:24.0.5
stage
:
docker
stage
:
docker
services
:
-
docker:24.0.5-dind
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
"
"
needs
:
[
build_backend
]
needs
:
[
build_backend
]
script
:
script
:
-
echo "🐳 Waiting for Docker daemon..."
-
until docker info > /dev/null 2>&1; do echo "⏳ Waiting..."; sleep 3; done
-
echo "🐳 Building Docker image locally..."
-
echo "🐳 Building Docker image locally..."
-
docker build --build-arg BUILD_NUMBER=$BUILD_NUMBER -t $DOCKER_IMAGE:$DOCKER_TAG .
-
docker build --build-arg BUILD_NUMBER=$BUILD_NUMBER -t $DOCKER_IMAGE:$DOCKER_TAG .
-
echo "✅ Docker image build complete."
-
echo "✅ Docker image build complete."
-
echo "🔍 Listing local Docker images:"
-
echo "🔍 Listing local Docker images:"
-
docker images | grep
cota-backend
|| (echo "❌ Image not found, build failed." && exit 1)
-
docker images | grep
$DOCKER_IMAGE
|| (echo "❌ Image not found, build failed." && exit 1)
only
:
only
:
changes
:
changes
:
-
'
**/*'
-
'
**/*'
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment