[StepSecurity] ci: Harden GitHub Actions
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
This commit is contained in:
20
.github/workflows/windows-periodic.yml
vendored
20
.github/workflows/windows-periodic.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
|
||||
- name: Install required packages
|
||||
run: |
|
||||
@@ -81,18 +81,18 @@ jobs:
|
||||
echo "SSH_PUB_KEY=$(cat ~/.ssh/id_rsa.pub)" >> $GITHUB_ENV
|
||||
|
||||
- name: AZLogin
|
||||
uses: azure/login@v2
|
||||
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDS }}
|
||||
|
||||
- name: AZResourceGroupCreate
|
||||
uses: azure/CLI@v1
|
||||
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1.0.9
|
||||
with:
|
||||
inlinescript: |
|
||||
az group create -n ${{ matrix.AZURE_RESOURCE_GROUP }} -l ${{ env.AZURE_DEFAULT_LOCATION }} --tags creationTimestamp=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
- name: AZTestVMCreate
|
||||
uses: azure/CLI@v1
|
||||
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1.0.9
|
||||
with:
|
||||
inlinescript: |
|
||||
DETAILS=$(az vm create -n winTestVM --admin-username ${{ env.DEFAULT_ADMIN_USERNAME }} --admin-password ${{ env.PASSWORD }} --image ${{ matrix.AZURE_IMG }} -g ${{ matrix.AZURE_RESOURCE_GROUP }} --nsg-rule SSH --size ${{ env.AZURE_DEFAULT_VM_SIZE }} --public-ip-sku Standard -o json)
|
||||
@@ -116,7 +116,7 @@ jobs:
|
||||
echo "VM_PUB_IP=$PUB_IP" >> $GITHUB_ENV
|
||||
|
||||
- name: EnableAZVMSSH
|
||||
uses: azure/CLI@v1
|
||||
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1.0.9
|
||||
with:
|
||||
inlinescript: |
|
||||
az vm run-command invoke --command-id RunPowerShellScript -n winTestVM -g ${{ matrix.AZURE_RESOURCE_GROUP }} --scripts @$GITHUB_WORKSPACE/script/setup/enable_ssh_windows.ps1 --parameters 'SSHPublicKey=${{ env.SSH_PUB_KEY }}'
|
||||
@@ -256,14 +256,14 @@ jobs:
|
||||
echo 'GCP_WORKLOAD_IDENTITY_PROVIDER=${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}' >> $GITHUB_OUTPUT
|
||||
|
||||
- name: AuthGcp
|
||||
uses: google-github-actions/auth@v2
|
||||
uses: google-github-actions/auth@8254fb75a33b976a221574d287e93919e6a36f70 # v2.1.6
|
||||
if: steps.AssignGcpCreds.outputs.GCP_SERVICE_ACCOUNT && steps.AssignGcpCreds.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER
|
||||
with:
|
||||
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
|
||||
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
|
||||
|
||||
- name: UploadJobReport
|
||||
uses: google-github-actions/upload-cloud-storage@v2.2.0
|
||||
uses: google-github-actions/upload-cloud-storage@e485962f2bef914ac9c3bdd571f821f0ba7946c4 # v2.2.0
|
||||
if: steps.AssignGcpCreds.outputs.GCP_SERVICE_ACCOUNT && steps.AssignGcpCreds.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER
|
||||
with:
|
||||
path: ${{ github.workspace }}/latest-build.txt
|
||||
@@ -271,7 +271,7 @@ jobs:
|
||||
parent: false
|
||||
|
||||
- name: UploadLogsDir
|
||||
uses: google-github-actions/upload-cloud-storage@v2.2.0
|
||||
uses: google-github-actions/upload-cloud-storage@e485962f2bef914ac9c3bdd571f821f0ba7946c4 # v2.2.0
|
||||
if: steps.AssignGcpCreds.outputs.GCP_SERVICE_ACCOUNT && steps.AssignGcpCreds.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER
|
||||
with:
|
||||
path: ${{ env.LOGS_DIR }}
|
||||
@@ -279,7 +279,7 @@ jobs:
|
||||
parent: false
|
||||
|
||||
- name: Check all CI stages succeeded
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const stepResults = {
|
||||
@@ -301,7 +301,7 @@ jobs:
|
||||
|
||||
- name: ResourceCleanup
|
||||
if: always()
|
||||
uses: azure/CLI@v1
|
||||
uses: azure/CLI@4db43908b9df2e7ac93c8275a8f9a448c59338dd # v1.0.9
|
||||
with:
|
||||
inlinescript: |
|
||||
az group delete -g ${{ matrix.AZURE_RESOURCE_GROUP }} --yes
|
||||
|
||||
Reference in New Issue
Block a user