Commit 7515ef62 authored by Benavides Ontiveros's avatar Benavides Ontiveros
Browse files

odify .\.gitlab-ci.yml

parent 1d94f7d7
Pipeline #12158 failed
......@@ -8,10 +8,12 @@ stages:
variables:
PYTHONPATH: "${CI_PROJECT_DIR}"
DOCKER_REGISTRY: "docker.io"
DOCKERHUB_REPO: "$DOCKER_USERNAME/reddit_data_fetcher" # Replace with your repo
DOCKERHUB_REPO: "$DOCKER_USERNAME/reddit_data_fetcher"
# ----------------- Base Template -----------------
.build_template:
tags: ["ubuntu", "vm"] # Match your runner tags
tags: ["ubuntu", "vm"]
image: docker:24.0.9
before_script:
- echo "Docker CLI info:"
- docker version
......@@ -22,6 +24,8 @@ lint:
image: python:3.10
extends: .build_template
before_script:
- echo "Docker CLI info:"
- docker version
- pip install flake8
script:
- echo "Linting Python code..."
......@@ -40,6 +44,8 @@ test:
image: python:3.10
extends: .build_template
before_script:
- echo "Docker CLI info:"
- docker version
- pip install pytest
- echo "Running Tests"
- echo "PYTHONPATH: ${PYTHONPATH}"
......@@ -57,8 +63,7 @@ test:
# ----------------- Diagnostics Stage -----------------
diag:
stage: diag
image: docker:24.0.9
tags: ["ubuntu","vm"]
extends: .build_template
script:
- echo "Check Docker socket and info..."
- ls -l /var/run || true
......@@ -74,7 +79,6 @@ diag:
# ----------------- Build Stage -----------------
build:
stage: build
image: docker:24.0.9
extends: .build_template
before_script:
- echo "Logging in to Docker registry..."
......@@ -97,8 +101,7 @@ build:
# ----------------- Deploy Stage -----------------
deploy:
stage: deploy
image: docker:24.0.9
tags: ["ubuntu","vm"]
extends: .build_template
script:
- echo "Logging in to Docker registry..."
- echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
......@@ -111,14 +114,13 @@ deploy:
docker push $DOCKERHUB_REPO:latest;
fi
# Optional: Run container to test runtime env variables
# Optional: Run container to test runtime environment variables
- docker run --rm \
-e SUBREDDITS="$SUBREDDITS" \
-e POST_LIMIT="$POST_LIMIT" \
-e COMMENT_LIMIT="$COMMENT_LIMIT" \
-e OUTPUT_DIR="$OUTPUT_DIR" \
$DOCKERHUB_REPO:$CI_COMMIT_SHORT_SHA
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
......
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