Skip to content

Create stop-ecs workflow#99

Merged
seniakalma merged 2 commits intozsa1from
arseni-add-ecs-stop
Jan 5, 2026
Merged

Create stop-ecs workflow#99
seniakalma merged 2 commits intozsa1from
arseni-add-ecs-stop

Conversation

@seniakalma
Copy link
Copy Markdown
Collaborator

@seniakalma seniakalma commented Dec 29, 2025

Motivation

The Zebra running in ECS is not configured to save the state in the file system (under /persistence) but in memory (RAM) - meaning that upon a task restart the state will be removed and the running time for the tx-tool will be improved (nullified).
This PR adds a simple Github Actions Workflow to kill all the currently running ECS tasks (ECS will spawn automatically new tasks)

Minimal IAM permissions to run this task:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ListTasksInSpecificCluster",
      "Effect": "Allow",
      "Action": "ecs:ListTasks",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "ecs:cluster": "arn:aws:ecs:eu-central-1:ACCOUNT_ID:cluster/dev-zebra-cluster"
        }
      }
    },
    {
      "Sid": "StopTasksInSpecificCluster",
      "Effect": "Allow",
      "Action": "ecs:StopTask",
      "Resource": "arn:aws:ecs:eu-central-1:ACCOUNT_ID:task/dev-zebra-cluster/*",
      "Condition": {
        "StringEquals": {
          "ecs:cluster": "arn:aws:ecs:eu-central-1:ACCOUNT_ID:cluster/dev-zebra-cluster"
        }
      }
    },
    {
      "Sid": "DescribeSpecificService",
      "Effect": "Allow",
      "Action": "ecs:DescribeServices",
      "Resource": "arn:aws:ecs:eu-central-1:ACCOUNT_ID:service/dev-zebra-cluster/dev-zebra"
    }
  ]
}

@seniakalma seniakalma requested a review from PaulLaux December 29, 2025 07:58
@seniakalma seniakalma self-assigned this Dec 29, 2025
@seniakalma
Copy link
Copy Markdown
Collaborator Author

seniakalma commented Dec 29, 2025

Add review condition for running this workflow
Everyone with access can trigger
Pablo/Arseni can approve

@seniakalma
Copy link
Copy Markdown
Collaborator Author

Add review condition for running this workflow Everyone with access can trigger Pablo/Arseni can approve

Enforced as part of the protection rules on the "production" environment @PaulLaux

Copy link
Copy Markdown

@PaulLaux PaulLaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid overall.

  • Did you test it?
  • Cleanup the PR description. Avoid redundant text.
  • Explain the confirmation mechanism in the PR description. Who exactly can run? who exactly can confirm? where it is configured.
  • Provide the minimal AWS IAM permissions required for this to work in the PR description.

- name: Validate confirmation
if: ${{ github.event.inputs.confirm != 'yes' }}
run: |
echo "Confirmation not provided. Please type 'yes' to confirm."
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please type yes?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message is not clear enough. Consider the context and where the message is being shown and provide a clearer message.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@seniakalma
Copy link
Copy Markdown
Collaborator Author

Looks solid overall.

  • Did you test it?
  • Cleanup the PR description. Avoid redundant text.
  • Explain the confirmation mechanism in the PR description. Who exactly can run? who exactly can confirm? where it is configured.
  • Provide the minimal AWS IAM permissions required for this to work in the PR description.

Tested it locally, it worked.
Clean the description, and added the minimal IAM permissions required for this.
Everyone with Write access to the repo can trigger this workflow. Only you and me can confirm the request itself, and actually make it start running. The formar is configured as part of regular Github Actions, the latter can be found here (as we use the "production" environment property):
https://github.com/QED-it/zebra/settings/environments/6923873946/edit

@PaulLaux
Copy link
Copy Markdown

PaulLaux commented Jan 3, 2026

@seniakalma
Copy link
Copy Markdown
Collaborator Author

No idea about the tests, I didn't change anything related. I re-ran them and they passed.
Tested with act, which is a way to run Github Actions locally. I tried and the workflow worked.
I tried to format it as code but it lost the indentation, but indeed JSON did the trick - thanks!

@seniakalma seniakalma merged commit af80ebe into zsa1 Jan 5, 2026
55 of 56 checks passed
@seniakalma seniakalma deleted the arseni-add-ecs-stop branch January 5, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants