Skip to content

Commit

Permalink
OCI ISL update prototype: add random port
Browse files Browse the repository at this point in the history
  • Loading branch information
DwarKapex committed Sep 5, 2024
1 parent 62e1eb3 commit e0a496c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/_oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ on:
type: string
required: true
description: Global CIDR to be added/deleted from security list of slurm cluster

outputs:
SSH_PORT: ${{ steps.new-ingress-list.outputs.SSH_PORT}}

permissions:
contents: read # to fetch code
actions: read # to cancel previous workflows
Expand All @@ -37,11 +39,6 @@ jobs:
with:
command: 'iam compartment list --compartment-id-in-subtree=true'
query: "data[?name=='jax'].id | [0]"

- name: Debug
run: |
echo ${{ steps.find-compartment-id.outputs.output }}
echo ${{ steps.find-compartment-id.outputs.raw_output }}

- name: Get security list from the compartment
uses: oracle-actions/[email protected]
Expand All @@ -53,6 +50,7 @@ jobs:
id: new-ingress-list
run: |
description="JTB GitHub Runner ${{ inputs.JOB_ID }}"
port=$((RANDOM % 9000 + 1000)) # generate port in range [1000,10000]
if [[ "${{ inputs.ACTION }}" == "add" ]]; then
sl_update='{"description": "'$description'",
"icmp-options": null,
Expand All @@ -62,8 +60,8 @@ jobs:
"source-type": "CIDR_BLOCK",
"tcp-options": {
"destination-port-range": {
"max": 22,
"min": 22
"max": '$port',
"min": '$port'
},
"source-port-range": null
},
Expand All @@ -84,3 +82,4 @@ jobs:
fi
oci network security-list update --force --security-list-id ${{ secrets.OCI_SECURITY_LIST_ID }} --ingress-security-rules "$updated_isr" >/dev/null 2>&1
echo "SSH_PORT=$port" >> $GITHUB_OUTPUT

0 comments on commit e0a496c

Please sign in to comment.