Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
software-project-WS25
Reddit Team
Commits
6dfb830c
Commit
6dfb830c
authored
Nov 28, 2025
by
Benavides Ontiveros
Browse files
modify .gitlab yaml
parent
05a16de4
Pipeline
#12166
canceled with stages
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
6dfb830c
...
...
@@ -9,26 +9,30 @@ variables:
DOCKER_REGISTRY
:
"
docker.io"
DOCKERHUB_REPO
:
"
$DOCKER_USERNAME/reddit_data_fetcher"
# ----------------- Base Template -----------------
# ----------------- Base Template
for Docker Executor
-----------------
.build_template
:
tags
:
[
"
ubuntu"
,
"
vm"
]
image
:
docker:24.0.9
tags
:
[
"
ubuntu"
,
"
vm"
]
# Your runner tags
image
:
docker:24.0.9
# Main job container containing Docker CLI
services
:
-
docker:dind
# Docker daemon for building images
variables
:
DOCKER_HOST
:
tcp://docker:2375
DOCKER_TLS_CERTDIR
:
"
"
# Needed to disable TLS for DIND
before_script
:
-
echo "Docker
CLI info:
"
-
docker
version
-
echo "
===
Docker
info (from DinD service) ===
"
-
docker
info ||
true
# ----------------- Lint Stage -----------------
# This does not need Docker; run it with a Python image.
lint
:
stage
:
lint
image
:
python:3.10
extends
:
.build_template
before_script
:
script
:
-
pip install flake8
script
:
|
echo "Linting Python code..."
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
echo "Done running Python lint stage"
-
echo "Linting Python code..."
-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
-
echo "Done running Python lint stage"
rules
:
-
if
:
'
$CI_COMMIT_BRANCH'
when
:
always
...
...
@@ -38,7 +42,7 @@ diag:
stage
:
diag
extends
:
.build_template
script
:
|
echo "Check Docker
socket and info...
"
echo "
===
Check
ing
Docker
connectivity ===
"
ls -l /var/run || true
stat /var/run/docker.sock || true
docker version || true
...
...
@@ -51,16 +55,17 @@ diag:
build
:
stage
:
build
extends
:
.build_template
before_script
:
-
echo "Logging in to Docker registry..."
-
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
script
:
|
echo "Logging in to Docker registry..."
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
echo "Building Docker image for commit: ${CI_COMMIT_SHORT_SHA}"
docker build \
--build-arg REDDIT_CLIENT_ID="$REDDIT_CLIENT_ID" \
--build-arg REDDIT_CLIENT_SECRET="$REDDIT_CLIENT_SECRET" \
-t $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA .
echo "Docker image built successfully!"
echo "Docker image built successfully."
rules
:
-
if
:
'
$CI_COMMIT_BRANCH'
when
:
always
...
...
@@ -72,14 +77,17 @@ deploy:
script
:
|
echo "Logging in to Docker registry..."
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
echo "Pushing Docker image to Docker Hub..."
echo "Pushing Docker image..."
docker push $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA
# Optional: push latest tag if on default branch
if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
echo "Tagging as 'latest'..."
docker tag $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA $DOCKERHUB_REPO:latest
docker push $DOCKERHUB_REPO:latest
fi
echo "Deploy completed."
rules
:
-
if
:
'
$CI_COMMIT_BRANCH'
when
:
always
\ No newline at end of file
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