diff --git a/.github/workflows/_oci.yaml b/.github/workflows/_oci.yaml index 8745b9e14..7a71b9819 100644 --- a/.github/workflows/_oci.yaml +++ b/.github/workflows/_oci.yaml @@ -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 @@ -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/run-oci-cli-command@v1.3.1 @@ -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, @@ -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 }, @@ -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