Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
List of MorphoCloudWorkflow changes:

```
$ git shortlog e52143d..d5be05b --no-merges
Jean-Christophe Fillion-Robin (1):
      feat: Support parallel processing adding lock/unlock to per instance specific workflows

muratmaga (1):
      doc(README): Add Funding Acknowledgments section
```

See MorphoCloud/MorphoCloudWorkflow@e52143d...d5be05b
  • Loading branch information
jcfr committed Feb 3, 2025
1 parent d169fef commit c39bb51
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 4 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/control-instance-from-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,29 @@ on:
"Name of the command to execute: create, delete, shelve, unshelve"
required: true
type: string

permissions:
# Permissions needed for reacting to IssueOps commands on issues
issues: write
checks: read
# Permissions needed for lock/unlock
contents: write

jobs:
control:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
inputs.issue_number }}
timeout: 3600

- name: Control instance
run: |
gh issue comment $ISSUE_NUMBER \
Expand All @@ -54,3 +67,12 @@ jobs:
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }}
mail_server_username: ${{secrets.MAIL_USERNAME}}
mail_server_password: ${{secrets.MAIL_PASSWORD}}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
inputs.issue_number }}
action: unlock
23 changes: 22 additions & 1 deletion .github/workflows/control-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
issue_comment:
types: [created]

# Permissions needed for reacting to IssueOps commands on issues
permissions:
# Permissions needed for reacting to IssueOps commands on issues
issues: write
checks: read
# Permissions needed for lock/unlock
contents: write

jobs:
control:
Expand All @@ -18,6 +20,7 @@ jobs:
contains(github.event.comment.body, '/shelve') ||
contains(github.event.comment.body, '/delete_instance') ) }}
steps:

- name: unshelve command
id: unshelve_command
uses: github/[email protected]
Expand Down Expand Up @@ -87,6 +90,15 @@ jobs:

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
timeout: 3600

- name: Control instance
id: control_instance
if: ${{ steps.command.outputs.continue == 'true' }}
Expand All @@ -100,3 +112,12 @@ jobs:
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }}
mail_server_username: ${{secrets.MAIL_USERNAME}}
mail_server_password: ${{secrets.MAIL_PASSWORD}}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
action: unlock
23 changes: 23 additions & 0 deletions .github/workflows/create-instance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on:
issue_comment:
types: [created]

permissions:
# Permissions needed for lock/unlock
contents: write

jobs:
create:
runs-on: self-hosted
if:
${{ !github.event.issue.pull_request && (
contains(github.event.comment.body, '/create') ) }}
steps:

- name: create command
id: create_command
uses: github/[email protected]
Expand All @@ -23,6 +28,15 @@ jobs:

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
timeout: 3600

- name: Add "request:approved" label
uses: actions/github-script@v7
with:
Expand Down Expand Up @@ -684,3 +698,12 @@ jobs:
setup_instance:
attach_volume:
send_email:

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
action: unlock
23 changes: 23 additions & 0 deletions .github/workflows/delete-instance-and-volume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on:
issue_comment:
types: [created]

permissions:
# Permissions needed for lock/unlock
contents: write

jobs:
delete_instance_and_volume:
runs-on: self-hosted
if:
${{ !github.event.issue.pull_request && (
contains(github.event.comment.body, '/delete_all') ) }}
steps:

- name: delete_instance_and_volume command
id: delete_instance_and_volume_command
uses: github/[email protected]
Expand All @@ -23,6 +28,15 @@ jobs:

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
timeout: 3600

- name: Delete volume
id: delete_volume
if:
Expand Down Expand Up @@ -50,3 +64,12 @@ jobs:
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }}
mail_server_username: ${{secrets.MAIL_USERNAME}}
mail_server_password: ${{secrets.MAIL_PASSWORD}}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
action: unlock
24 changes: 24 additions & 0 deletions .github/workflows/delete-volume.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ on:
issue_comment:
types: [created]

permissions:
# Permissions needed for lock/unlock
contents: write

jobs:
delete_volume:
runs-on: self-hosted
if:
${{ !github.event.issue.pull_request && (
contains(github.event.comment.body, '/delete_volume') ) }}
steps:


- name: delete_volume command
id: delete_volume_command
uses: github/[email protected]
Expand All @@ -23,6 +29,15 @@ jobs:

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
timeout: 3600

- name: Delete volume
id: delete_volume
if: ${{ steps.delete_volume_command.outputs.continue == 'true' }}
Expand All @@ -32,3 +47,12 @@ jobs:
issue_number: ${{ github.event.issue.number }}
instance_name_prefix: ${{ vars.INSTANCE_NAME_PREFIX }}
volume_name_suffix: ${{ vars.VOLUME_NAME_SUFFIX }}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
action: unlock
18 changes: 18 additions & 0 deletions .github/workflows/update-issue-from-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
inputs.issue_number }}
timeout: 3600

- name: Add comment
run: |
gh issue comment $ISSUE_NUMBER \
Expand All @@ -51,3 +60,12 @@ jobs:
command_name: ${{ inputs.command_name }}
token: ${{ secrets.GITHUB_TOKEN }}
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
inputs.issue_number }}
action: unlock
27 changes: 24 additions & 3 deletions .github/workflows/update-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
issue_comment:
types: [created]

# Permissions needed for reacting to IssueOps commands on issues
permissions:
# Permissions needed for reacting to IssueOps commands on issues
issues: write
checks: read
# Permissions needed for lock/unlock
contents: write

jobs:
update-issue:
Expand All @@ -17,6 +19,7 @@ jobs:
contains(github.event.comment.body, '/encode_email') ||
contains(github.event.comment.body, '/decode_email') ) }}
steps:

- name: encode_email command
id: encode_email_command
uses: github/[email protected]
Expand All @@ -41,6 +44,17 @@ jobs:
"${{ vars.MORPHOCLOUD_GITHUB_ADMINS }},${{
github.event.issue.user.login }}"

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
timeout: 3600

- name: Set command metadata
id: command
if:
Expand Down Expand Up @@ -69,8 +83,6 @@ jobs:
DECODE_EMAIL_COMMAND_CONTINUE:
${{ steps.decode_email_command.outputs.continue }}

- uses: actions/checkout@v4

- name: Update issue description
if: ${{ steps.command.outputs.continue == 'true' }}
uses: ./.github/actions/update-issue-description
Expand All @@ -79,3 +91,12 @@ jobs:
command_name: ${{ steps.command.outputs.command_name }}
token: ${{ secrets.GITHUB_TOKEN }}
string_encryption_key: ${{ secrets.STRING_ENCRYPTION_KEY }}

- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
github.event.issue.number }}
action: unlock
18 changes: 18 additions & 0 deletions .github/workflows/validate-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:

- uses: actions/checkout@v4

- name: Acquire lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
steps.collect_inputs.outputs.issue_number }}
timeout: 3600

- name: Extract fields
id: extract
uses: ./.github/actions/extract-issue-fields
Expand Down Expand Up @@ -234,3 +243,12 @@ jobs:
> Once the emails are correctly formatted and match, they will be automatically obfuscated for security.
See details [here](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
- name: Release lock
uses: actions/lock@v2
if: always()
with:
path:
lock-${{ vars.MORPHOCLOUD_OS_CLOUD }}-instance-${{
steps.collect_inputs.outputs.issue_number }}
action: unlock

0 comments on commit c39bb51

Please sign in to comment.