Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM quay.io/rofrano/python:3.11-slim

# Add any tools that are needed beyond Python 3.11
RUN apt-get update && \
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools && \
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools iputils-ping && \
apt-get autoremove -y && \
apt-get clean -y

Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@
"tamasfe.even-better-toml",
"donjayamanne.githistory",
"GitHub.vscode-pull-request-github",
"github.vscode-github-actions",
"hbenl.vscode-test-explorer",
"LittleFoxTeam.vscode-python-test-adapter",
"redhat.vscode-yaml",
"unjinjang.rest-api-client",
"ms-azuretools.vscode-docker",
"inercia.vscode-k3d",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"inercia.vscode-k3d",
"redhat.vscode-openshift-connector",
"streetsidesoftware.code-spell-checker",
"bbenoist.vagrant"
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/scripts/setup-lab.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
echo "**********************************************************************"
echo "Setting up Docker lab environment..."
echo "**********************************************************************"
echo "Setting up OpenShift lab environment..."
echo "**********************************************************************\n"

echo "Pulling custom Python:3.11-slim image from quay.io..."
docker pull quay.io/rofrano/python:3.11-slim
Expand All @@ -13,6 +13,6 @@ sudo bash -c "echo '127.0.0.1 cluster-registry' >> /etc/hosts"
echo "Making git stop complaining about unsafe folders"
git config --global --add safe.directory /app

echo "**********************************************************************"
echo "\n**********************************************************************"
echo "Setup complete"
echo "**********************************************************************"
149 changes: 0 additions & 149 deletions .tekton/pipeline.yaml

This file was deleted.

21 changes: 17 additions & 4 deletions .tekton/tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ spec:
- name: source
description: The workspace with the source code.
description: >-
Use to run pylint on the provided input source. If Poetry is being used
it will detect the poetry.lock file and install via requirements export.
Use to run pylint on the provided input source.
If Poetry or Pipenv is being used it will detect
the poetry.lock and Pipfile file and install using them.
params:
- name: image
description: The container image with pylint
Expand Down Expand Up @@ -49,6 +50,10 @@ spec:
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install
elif [ -e "Pipfile" ]; then
echo "Found Pipfile file: using pipenv ..."
python -m pip install --upgrade pip pipenv
pipenv install --system --dev
elif [ -n "$(params.requirements-file)" ] && [ -e "$(params.requirements-file)" ]; then
python -m pip install --user -r "$(params.requirements-file)"
fi
Expand Down Expand Up @@ -79,7 +84,7 @@ spec:
- name: source
description: >-
This task can be used to perform unit tests with pytest.
It supports both requirements.txt and poetry.lock files.
It supports both requirements.txt, Pipfile, & poetry.lock files.

It also has the ability to create an environment variable
that is sourced from a Secret. This allows you to define
Expand Down Expand Up @@ -118,6 +123,10 @@ spec:
python -m pip install --upgrade pip poetry
poetry config virtualenvs.create false
poetry install
elif [ -e "Pipfile" ]; then
echo "Found Pipfile file: using pipenv ..."
python -m pip install --upgrade pip pipenv
pipenv install --system --dev
elif -e "requirements.txt" ]; then
python -m pip install --user -r requirements.txt
fi
Expand Down Expand Up @@ -259,7 +268,7 @@ spec:
default: "chrome"
steps:
- name: behave
image: rofrano/pipeline-selenium
image: quay.io/rofrano/pipeline-selenium
workingDir: $(workspaces.source.path)
env:
- name: BASE_URL
Expand All @@ -278,6 +287,10 @@ spec:
echo "Found poetry.lock file: using poetry"
python -m pip install poetry poetry-plugin-export
poetry export --with=dev -f requirements.txt --output requirements.txt
elif [ -e "Pipfile" ]; then
echo "Found Pipfile file: using pipenv ..."
python -m pip install --upgrade pip pipenv
pipenv requirements --dev > requirements.txt
fi
python -m pip install --user -r requirements.txt

Expand Down
16 changes: 5 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,17 @@ clean: ## Removes all dangling build cache
docker image prune -f
docker buildx prune -f

.PHONY: venv
venv: ## Create a Python virtual environment
$(info Creating Python 3 virtual environment...)
poetry shell

.PHONY: install
install: ## Install Python dependencies
$(info Installing dependencies...)
poetry config virtualenvs.create false
poetry install
sudo pipenv install --system --dev

.PHONY: lint
lint: ## Run the linter
$(info Running linting...)
flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
pylint service tests --max-line-length=127
-flake8 service tests --count --select=E9,F63,F7,F82 --show-source --statistics
-flake8 service tests --count --max-complexity=10 --max-line-length=127 --statistics
-pylint service tests --max-line-length=127

.PHONY: test
test: ## Run the unit tests
Expand All @@ -67,7 +61,7 @@ cluster: ## Create a K3D Kubernetes cluster with load balancer and registry
.PHONY: cluster-rm
cluster-rm: ## Remove a K3D Kubernetes cluster
$(info Removing Kubernetes cluster...)
k3d cluster delete nyu-devops
k3d cluster delete $(CLUSTER)

.PHONY: tekton
tekton: ## Install Tekton
Expand Down
10 changes: 5 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ python-dotenv = "~=1.0.1"
gunicorn = "~=23.0.0"

[dev-packages]
black = "~=25.1.0"
coverage = "~=7.6.10"
flake8 = "~=7.1.1"
honcho = "~=2.0.0"
pylint = "~=3.3.4"
flake8 = "~=7.1.1"
black = "~=25.1.0"
pytest = "~=8.3.4"
pytest-pspec = "~=0.0.4"
pytest-cov = "~=6.0.0"
factory-boy = "~=3.3.1"
honcho = "~=2.0.0"
factory-boy = "~=3.3.3"
coverage = "~=7.6.12"
httpie = "~=3.2.4"

[requires]
Expand Down
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ testpaths =
max-line-length = 127

[pylint.'MESSAGES CONTROL']
disable = "no-member,protected-access,global-statement"
disable = no-member,protected-access,global-statement

# setup Flake8 configuration
[flake8]
Expand All @@ -32,7 +32,9 @@ line-length = 127
# Setup Coverage configuration
[coverage:run]
source = service
omit = venv/*
omit =
venv/*
.venv/*

[coverage:report]
show_missing = true
Expand All @@ -47,3 +49,4 @@ ignore_errors = true

[coverage:html]
title = 'Test Coverage Report'
directory = 'coverage_report'