Commit f8fced6f authored by Benavides Ontiveros's avatar Benavides Ontiveros
Browse files

verify docker push and login

parent 77d0b4ca
Pipeline #12177 failed
......@@ -29,11 +29,11 @@ lint:
tags: ["ubuntu", "vm"]
before_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 the Python Lint stage"
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 the Python Lint stage"
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH'
......@@ -50,8 +50,8 @@ test:
before_script:
- pip install pytest
- echo "Running Tests"
script: |
pytest -q || echo "No tests found"
script:
- pytest -q || echo "No tests found"
after_script:
- echo "Tests completed successfully"
rules:
......@@ -66,12 +66,14 @@ test:
diag:
stage: diag
extends: .build_template
script: |
echo "Check Docker access:"
ls -l /var/run
stat /var/run/docker.sock || true
docker version || true
docker info || true
script:
- echo "Check Docker access:"
- ls -l /var/run
- stat /var/run/docker.sock || true
- echo "Docker version:"
- docker version || true
- echo "Docker info:"
- docker info || true
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH'
......@@ -86,10 +88,7 @@ build:
extends: .build_template
script:
- 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 .
- 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 "Listing local images:"
- docker images
......@@ -110,20 +109,16 @@ deploy:
- echo "Logging in to Docker Hub..."
- echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker info | grep Username || (echo "Docker login failed!" && exit 1)
- echo "Listing local images before push:"
- docker images
- echo "Pushing image: $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA"
- docker push $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA || (echo "Push failed!" && exit 1)
- if [ "$CI_COMMIT_BRANCH" = "$CI_DEFAULT_BRANCH" ]; then
echo "Tagging image as latest...";
docker tag $DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA $DOCKERHUB_REPO:latest;
echo "Pushing latest tag...";
docker push $DOCKERHUB_REPO:latest || (echo "Push latest failed!" && exit 1);
fi
- echo "Listing local images after push:"
- docker images
rules:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment