Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*
!pyproject.toml
!poetry.lock
!README.md
!integration/testrun.py
!hv4gha
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
strategy:
matrix:
py_version: ["3.10", "3.11"]
dependencies: ["constrained", "unconstrained"]

steps:
- name: Checkout
Expand All @@ -41,6 +42,10 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Update dependencies
if: matrix.dependencies == 'unconstrained'
run: poetry update

- name: Check import order
run: poetry run isort --check hv4gha/ integration/

Expand All @@ -67,6 +72,7 @@ jobs:
uses: super-linter/super-linter/slim@v5
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_GITLEAKS: false
VALIDATE_JSCPD: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 30 additions & 12 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,38 @@ jobs:
- name: Enable Vault's Transit Engine
run: docker compose -f integration/docker-compose.yaml run --no-deps vault-setup

- name: Import App key (Python 3.10)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310 import
- name: Import App key (Python 3.10) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-constrained import

- name: Issue Access Token (Python 3.10)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310 issue
- name: Issue Access Token (Python 3.10) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-constrained issue

- name: Issue scoped Access Token (Python 3.10)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310 issue-scoped
- name: Issue scoped Access Token (Python 3.10) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-constrained issue-scoped

- name: Import App key (Python 3.11)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311 import
- name: Import App key (Python 3.10) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-unconstrained import

- name: Issue Access Token (Python 3.11)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311 issue
- name: Issue Access Token (Python 3.10) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-unconstrained issue

- name: Issue scoped Access Token (Python 3.11)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311 issue-scoped
- name: Issue scoped Access Token (Python 3.10) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py310-unconstrained issue-scoped

- name: Import App key (Python 3.11) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-constrained import

- name: Issue Access Token (Python 3.11) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-constrained issue

- name: Issue scoped Access Token (Python 3.11) (constrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-constrained issue-scoped

- name: Import App key (Python 3.11) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-unconstrained import

- name: Issue Access Token (Python 3.11) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-unconstrained issue

- name: Issue scoped Access Token (Python 3.11) (unconstrained)
run: docker compose -f integration/docker-compose.yaml run --no-deps testrun-py311-unconstrained issue-scoped
18 changes: 16 additions & 2 deletions integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# hadolint global ignore=DL3013

ARG pyver=3.11
FROM python:${pyver}-slim-bookworm
FROM python:${pyver}-slim-bookworm AS python-prepare

RUN pip install --no-cache-dir poetry

WORKDIR /pip
COPY pyproject.toml poetry.lock /pip/

RUN poetry export --without-hashes --format=requirements.txt --output=constraints.txt


FROM python:${pyver}-slim-bookworm AS python-hv4gha

COPY --from=python-prepare /pip/constraints.txt /src/
COPY pyproject.toml README.md /src/
COPY hv4gha /src/hv4gha

RUN pip install --no-cache-dir /src/
ARG pip_extra=""
RUN pip install --no-cache-dir ${pip_extra} /src/

COPY --chmod=755 integration/testrun.py /app/
ENTRYPOINT ["/app/testrun.py"]
52 changes: 48 additions & 4 deletions integration/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

version: "3.8"
services:
testrun-py310:
testrun-py310-constrained:
cap_drop:
- ALL
security_opt:
Expand All @@ -12,18 +12,62 @@ services:
build:
args:
pyver: "3.10"
pip_extra: --constraint=/src/constraints.txt
context: ..
dockerfile: integration/Dockerfile
environment:
HV4GHA_KEYNAME: testkey310
HV4GHA_KEYNAME: test-310-constrained
HV4GHA_VAULT_ADDR: http://vault-server:8200
HV4GHA_VAULT_TOKEN: BatteryStaple
env_file: .env
command: [import, issue, issue-scoped]
depends_on:
- vault-setup

testrun-py311:
testrun-py310-unconstrained:
cap_drop:
- ALL
security_opt:
- no-new-privileges
read_only: true
user: 3100:3100
build:
args:
pyver: "3.10"
context: ..
dockerfile: integration/Dockerfile
environment:
HV4GHA_KEYNAME: test-310-unconstrained
HV4GHA_VAULT_ADDR: http://vault-server:8200
HV4GHA_VAULT_TOKEN: BatteryStaple
env_file: .env
command: [import, issue, issue-scoped]
depends_on:
- vault-setup

testrun-py311-constrained:
cap_drop:
- ALL
security_opt:
- no-new-privileges
read_only: true
user: 3110:3110
build:
args:
pyver: "3.11"
pip_extra: --constraint=/src/constraints.txt
context: ..
dockerfile: integration/Dockerfile
environment:
HV4GHA_KEYNAME: test-311-constrained
HV4GHA_VAULT_ADDR: http://vault-server:8200
HV4GHA_VAULT_TOKEN: BatteryStaple
env_file: .env
command: [import, issue, issue-scoped]
depends_on:
- vault-setup

testrun-py311-unconstrained:
cap_drop:
- ALL
security_opt:
Expand All @@ -36,7 +80,7 @@ services:
context: ..
dockerfile: integration/Dockerfile
environment:
HV4GHA_KEYNAME: testkey311
HV4GHA_KEYNAME: test-311-unconstrained
HV4GHA_VAULT_ADDR: http://vault-server:8200
HV4GHA_VAULT_TOKEN: BatteryStaple
env_file: .env
Expand Down