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
f8fced6f
Commit
f8fced6f
authored
Nov 28, 2025
by
Benavides Ontiveros
Browse files
verify docker push and login
parent
77d0b4ca
Pipeline
#12177
failed
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
f8fced6f
...
@@ -29,11 +29,11 @@ lint:
...
@@ -29,11 +29,11 @@ lint:
tags
:
[
"
ubuntu"
,
"
vm"
]
tags
:
[
"
ubuntu"
,
"
vm"
]
before_script
:
before_script
:
-
pip install flake8
-
pip install flake8
script
:
|
script
:
echo "Linting Python code..."
-
echo "Linting Python code..."
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
echo "Done running the Python Lint stage"
-
echo "Done running the Python Lint stage"
rules
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
-
if
:
'
$CI_COMMIT_BRANCH'
-
if
:
'
$CI_COMMIT_BRANCH'
...
@@ -50,8 +50,8 @@ test:
...
@@ -50,8 +50,8 @@ test:
before_script
:
before_script
:
-
pip install pytest
-
pip install pytest
-
echo "Running Tests"
-
echo "Running Tests"
script
:
|
script
:
pytest -q || echo "No tests found"
-
pytest -q || echo "No tests found"
after_script
:
after_script
:
-
echo "Tests completed successfully"
-
echo "Tests completed successfully"
rules
:
rules
:
...
@@ -66,12 +66,14 @@ test:
...
@@ -66,12 +66,14 @@ test:
diag
:
diag
:
stage
:
diag
stage
:
diag
extends
:
.build_template
extends
:
.build_template
script
:
|
script
:
echo "Check Docker access:"
-
echo "Check Docker access:"
ls -l /var/run
-
ls -l /var/run
stat /var/run/docker.sock || true
-
stat /var/run/docker.sock ||
true
docker version || true
-
echo "Docker version:"
docker info || true
-
docker version ||
true
-
echo "Docker info:"
-
docker info ||
true
rules
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
-
if
:
'
$CI_COMMIT_BRANCH'
-
if
:
'
$CI_COMMIT_BRANCH'
...
@@ -86,10 +88,7 @@ build:
...
@@ -86,10 +88,7 @@ build:
extends
:
.build_template
extends
:
.build_template
script
:
script
:
-
echo "Building Docker image for commit
:
${CI_COMMIT_SHORT_SHA}"
-
echo "Building Docker image for commit
:
${CI_COMMIT_SHORT_SHA}"
-
docker build \
-
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 .
--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!"
-
echo "Listing local images:"
-
echo "Listing local images:"
-
docker images
-
docker images
...
@@ -110,20 +109,16 @@ deploy:
...
@@ -110,20 +109,16 @@ deploy:
-
echo "Logging in to Docker Hub..."
-
echo "Logging in to Docker Hub..."
-
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
-
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
-
docker info | grep Username || (echo "Docker login failed!" && exit 1)
-
docker info | grep Username || (echo "Docker login failed!" && exit 1)
-
echo "Listing local images before push:"
-
echo "Listing local images before push:"
-
docker images
-
docker images
-
echo "Pushing image
:
$DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA"
-
echo "Pushing image
:
$DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA"
-
docker push $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA || (echo "Push failed!" && exit 1)
-
docker push $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA || (echo "Push failed!" && exit 1)
-
if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
-
if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
echo "Tagging image as latest...";
echo "Tagging image as latest...";
docker tag $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA $DOCKERHUB_REPO:latest;
docker tag $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA $DOCKERHUB_REPO:latest;
echo "Pushing latest tag...";
echo "Pushing latest tag...";
docker push $DOCKERHUB_REPO:latest || (echo "Push latest failed!" && exit 1);
docker push $DOCKERHUB_REPO:latest || (echo "Push latest failed!" && exit 1);
fi
fi
-
echo "Listing local images after push:"
-
echo "Listing local images after push:"
-
docker images
-
docker images
rules
:
rules
:
...
...
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