From c8aeedafdb905b84386ca71f3e23bb24a1c9cfdb Mon Sep 17 00:00:00 2001 From: Valentin Afanasev Date: Tue, 5 Aug 2025 02:11:04 +0300 Subject: [PATCH] Initial commit --- .gitea/actions/create/action.yml | 12 ++++++++ .gitea/actions/create/postgres-template.yaml | 31 ++++++++++++++++++++ .gitea/actions/delete/action.yml | 11 +++++++ 3 files changed, 54 insertions(+) create mode 100644 .gitea/actions/create/action.yml create mode 100644 .gitea/actions/create/postgres-template.yaml create mode 100644 .gitea/actions/delete/action.yml diff --git a/.gitea/actions/create/action.yml b/.gitea/actions/create/action.yml new file mode 100644 index 0000000..637b61e --- /dev/null +++ b/.gitea/actions/create/action.yml @@ -0,0 +1,12 @@ +name: Run pg for tests +inputs: + service_name: + required: true +runs: + using: composite + env: + POD_NAME: ${{ inputs.service_name }} + APP_NAME: ${{ inputs.service_name }} + SERVICE_NAME: ${{ inputs.service_name }} + steps: + run: envsubst < postgres-template.yaml | werf kubectl apply - diff --git a/.gitea/actions/create/postgres-template.yaml b/.gitea/actions/create/postgres-template.yaml new file mode 100644 index 0000000..72d5c04 --- /dev/null +++ b/.gitea/actions/create/postgres-template.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: Pod +metadata: + name: ${POD_NAME} + labels: + app: ${APP_NAME} +spec: + containers: + - name: postgres + image: postgres:15 + ports: + - containerPort: 5432 + env: + - name: POSTGRES_PASSWORD + value: test + readinessProbe: + exec: + command: ["pg_isready", "-U", "postgres"] + initialDelaySeconds: 5 + periodSeconds: 10 +--- +apiVersion: v1 +kind: Service +metadata: + name: ${SERVICE_NAME} +spec: + selector: + app: ${APP_NAME} + ports: + - port: 5432 + targetPort: 5432 diff --git a/.gitea/actions/delete/action.yml b/.gitea/actions/delete/action.yml new file mode 100644 index 0000000..f3e7007 --- /dev/null +++ b/.gitea/actions/delete/action.yml @@ -0,0 +1,11 @@ +name: Stop pg for tests +inputs: + service_name: + required: true +runs: + using: composite + env: + SERVICE_NAME: ${{ inputs.service_name }} + steps: + run: werf kubectl delete service/${SERVICE_NAME} --ignore-not-found + run: werf kubectl delete pod/${SERVICE_NAME} --ignore-not-found