Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ci #2

Merged
merged 8 commits into from
Mar 6, 2024
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
8 changes: 8 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
per-file-ignores =
# imported but unused
__init__.py: F401

max-complexity = 10

extend-ignore = E501,C901
39 changes: 39 additions & 0 deletions .github/workflows/controller-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Controller Container

on:
pull_request:
paths:
- 'containers/controller/**'
push:
branches:
- main
paths:
- 'containers/controller/**'

permissions:
contents: write
pull-requests: read
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
controller-container:
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: controller-container
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-repo: ${{ vars.HARBOR_PROJECT }}/controller
release-tag-format: 'controller-container-${version}'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
build-file: containers/controller/Dockerfile
build-context: containers/controller
secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
slack-token: ${{ secrets.SLACK_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/flake8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Flake8

on:
pull_request:
paths:
- '.flake8'
- 'containers/controller/src/**.py'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
flake8:
runs-on:
labels: [self-hosted, linux, x64]
group: light

steps:
- name: clone repo
uses: actions/checkout@v4

- name: install flake8
run: pip install flake8

- name: install flake8 annotations
uses: rbialon/flake8-annotations@v1

- name: run flake8
run: |
flake8 containers/controller/src
42 changes: 42 additions & 0 deletions .github/workflows/guacamole-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Guacamole Chart

on:
pull_request:
paths:
- 'charts/guacamole/**'
push:
branches:
- main
paths:
- 'charts/guacamole/**'

permissions:
contents: write
pull-requests: read
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
guacamole-chart:
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: guacamole-chart
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-project: ${{ vars.HARBOR_PROJECT }}
registry-repo: guacamole
release-tag-format: 'guacamole-chart-${version}'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
chart: charts/guacamole
test-command: |
helm template $CHART --debug

secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
slack-token: ${{ secrets.SLACK_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/guacamole-crds-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Guacamole Chart

on:
pull_request:
paths:
- 'charts/guacamole-crds/**'
push:
branches:
- main
paths:
- 'charts/guacamole-crds/**'

permissions:
contents: write
pull-requests: read
actions: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
guacamole-crds-chart:
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: guacamole-crds-chart
registry: ${{ vars.HARBOR_REGISTRY }}
registry-user: ${{ vars.HARBOR_USER }}
registry-project: ${{ vars.HARBOR_PROJECT }}
registry-repo: guacamole-crds
release-tag-format: 'guacamole-crds-chart-${version}'
cosign-public-key: ${{ vars.COSIGN_PUBLIC_KEY }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
chart: charts/guacamole-crds
test-command: |
helm template $CHART --debug

secrets:
cosign-private-key: ${{ secrets.COSIGN_PRIVATE_KEY }}
cosign-password: ${{ secrets.COSIGN_PASSWORD }}
registry-token: ${{ secrets.HARBOR_TOKEN }}
slack-token: ${{ secrets.SLACK_TOKEN }}
1 change: 1 addition & 0 deletions charts/guacamole-crds/.helmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line..
Expand Down
1 change: 1 addition & 0 deletions charts/guacamole/.helmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line..
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def build_url(
)

logging.debug(f"{url=}")
return url
return url
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def main(
username = record["attributes"].get(ldap_username_attribute, "")
logging.debug(f"{dn=} {ldap_username_attribute}={username}")

logging.debug(f"sleeping...")
logging.debug("sleeping...")
time.sleep(60)

logging.info("halting")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@


def db_create_service_user(
client: Connection,
username: str,
password: str
):
client: Connection,
username: str,
password: str
):

logging.debug(f"{username=}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ def ldap_authenticate_user(
client.start_tls()

return client

Loading