diff --git a/src/runboat/api.py b/src/runboat/api.py index 295a989..26118b9 100644 --- a/src/runboat/api.py +++ b/src/runboat/api.py @@ -45,6 +45,7 @@ class Build(BaseModel): name: str commit_info: github.CommitInfo deploy_link: str + deploy_link_mailhog: str repo_target_branch_link: str repo_pr_link: str | None repo_commit_link: str diff --git a/src/runboat/kubefiles/deployment.yaml b/src/runboat/kubefiles/deployment.yaml index b71316f..f7b7acc 100644 --- a/src/runboat/kubefiles/deployment.yaml +++ b/src/runboat/kubefiles/deployment.yaml @@ -56,6 +56,37 @@ spec: requests: cpu: 50m memory: 100Mi + - name: mailhog + image: mailhog + env: + - name: MH_API_BIND_ADDR + value: 0.0.0.0:8025 + - name: MH_UI_BIND_ADDR + value: 0.0.0.0:8025 + - name: MH_SMTP_BIND_ADDR + value: 0.0.0.0:1025 + ports: + - name: smtp + containerPort: 1025 + - name: web + containerPort: 8025 + readinessProbe: + tcpSocket: + port: 8025 + initialDelaySeconds: 2 + periodSeconds: 2 + livenessProbe: + tcpSocket: + port: 8025 + initialDelaySeconds: 30 + periodSeconds: 30 + resources: + limits: + cpu: 100m + memory: 200Mi + requests: + cpu: 50m + memory: 100Mi volumes: - name: runboat-scripts configMap: diff --git a/src/runboat/kubefiles/ingress_mailhog.yaml b/src/runboat/kubefiles/ingress_mailhog.yaml new file mode 100644 index 0000000..fd6442f --- /dev/null +++ b/src/runboat/kubefiles/ingress_mailhog.yaml @@ -0,0 +1,15 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: mailhog +spec: + rules: + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: odoo + port: + number: 8025 diff --git a/src/runboat/kubefiles/ingress.yaml b/src/runboat/kubefiles/ingress_odoo.yaml similarity index 100% rename from src/runboat/kubefiles/ingress.yaml rename to src/runboat/kubefiles/ingress_odoo.yaml diff --git a/src/runboat/kubefiles/kustomization.yaml.jinja b/src/runboat/kubefiles/kustomization.yaml.jinja index a3645b6..aa78542 100644 --- a/src/runboat/kubefiles/kustomization.yaml.jinja +++ b/src/runboat/kubefiles/kustomization.yaml.jinja @@ -3,7 +3,8 @@ resources: - pvc.yaml - deployment.yaml - service.yaml - - ingress.yaml + - ingress_odoo.yaml + - ingress_mailhog.yaml {%- elif mode == "initialize" %} - pvc.yaml - initialize.yaml @@ -28,6 +29,9 @@ images: - name: odoo newName: "{{ image_name }}" newTag: "{{ image_tag }}" + - name: mailhog + newName: "mailhog/mailhog" + newTag: "latest" secretGenerator: - name: odoosecretenv @@ -71,3 +75,10 @@ patches: - op: replace path: /spec/rules/0/host value: {{ build_slug }}.{{ build_domain }} + - target: + kind: Ingress + name: mailhog + patch: |- + - op: replace + path: /spec/rules/0/host + value: {{ build_slug }}.mail.{{ build_domain }} diff --git a/src/runboat/kubefiles/runboat-start.sh b/src/runboat/kubefiles/runboat-start.sh index 37aa7af..39fd7bc 100755 --- a/src/runboat/kubefiles/runboat-start.sh +++ b/src/runboat/kubefiles/runboat-start.sh @@ -31,4 +31,6 @@ unbuffer $(which odoo || which openerp-server) \ --no-database-list \ --database ${PGDATABASE} \ --db-filter=^${PGDATABASE} \ - --db_user=${PGUSER} + --db_user=${PGUSER} \ + --smtp=localhost \ + --smtp-port=1025 diff --git a/src/runboat/kubefiles/service.yaml b/src/runboat/kubefiles/service.yaml index f73a16d..c34ebf5 100644 --- a/src/runboat/kubefiles/service.yaml +++ b/src/runboat/kubefiles/service.yaml @@ -13,5 +13,9 @@ spec: targetPort: 8072 protocol: TCP name: longpolling + - port: 8025 + targetPort: 8025 + protocol: TCP + name: mailhog-web selector: app: odoo diff --git a/src/runboat/models.py b/src/runboat/models.py index abd57a2..cb5be25 100644 --- a/src/runboat/models.py +++ b/src/runboat/models.py @@ -135,6 +135,10 @@ class Build(BaseModel): def deploy_link(self) -> str: return f"http://{self.slug}.{settings.build_domain}" + @property + def deploy_link_mailhog(self) -> str: + return f"http://{self.slug}.mail.{settings.build_domain}" + @property def repo_target_branch_link(self) -> str: return ( diff --git a/src/runboat/webui-templates/runboat-build-element.js b/src/runboat/webui-templates/runboat-build-element.js index d2580c6..03fe21c 100644 --- a/src/runboat/webui-templates/runboat-build-element.js +++ b/src/runboat/webui-templates/runboat-build-element.js @@ -19,7 +19,7 @@ class RunboatBuildElement extends LitElement { static styles = css` .build-card { - width: 16em; + width: 16.2em; padding: 0.5em; border-radius: 0.5em; background-color: lightgray; @@ -72,7 +72,7 @@ class RunboatBuildElement extends LitElement { html`⦙ 🗒 log`:"" } ${this.build.status == "started"? - html`⦙ 🚪 live`:"" + html`⦙ 🚪 live `:"" }

diff --git a/tests/test_render_kubefiles.py b/tests/test_render_kubefiles.py index 98efd91..6afd4d4 100644 --- a/tests/test_render_kubefiles.py +++ b/tests/test_render_kubefiles.py @@ -7,7 +7,8 @@ resources: - pvc.yaml - deployment.yaml - service.yaml - - ingress.yaml + - ingress_odoo.yaml + - ingress_mailhog.yaml namespace: runboat-builds @@ -26,6 +27,9 @@ images: - name: odoo newName: "ghcr.io/oca/oca-ci" newTag: "py3.8-odoo15.0" + - name: mailhog + newName: "mailhog/mailhog" + newTag: "latest" secretGenerator: - name: odoosecretenv @@ -64,6 +68,13 @@ patches: - op: replace path: /spec/rules/0/host value: build-slug.runboat.odoo-community.org + - target: + kind: Ingress + name: mailhog + patch: |- + - op: replace + path: /spec/rules/0/host + value: build-slug.mail.runboat.odoo-community.org """