Skip to content

Commit

Permalink
feat: add ci (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
JossWhittle authored Mar 6, 2024
1 parent a21e8d6 commit dddb377
Show file tree
Hide file tree
Showing 20 changed files with 170 additions and 7 deletions.
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/pr-and-release-container.yaml@v1.4.2-containers
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/pr-and-release-chart.yaml@v1.2.0-charts
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/pr-and-release-chart.yaml@v1.2.0-charts
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
File renamed without changes.
File renamed without changes.
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

File renamed without changes.

0 comments on commit dddb377

Please sign in to comment.