Skip to content

Commit 4dfc419

Browse files
authored
chore: add cloud tag inputs (#652)
* chore: add cloud tag inputs * chore: add cloud tag inputs * chore: change webhook * chore: change set webhook
1 parent 114a15b commit 4dfc419

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.github/workflows/trivy-scan-cloud.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Trivy Scan Cloud
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
CLOUD_TAG:
7+
description: "cloud tag"
8+
type: string
9+
required: false
10+
default: ''
511
schedule:
612
- cron: '0 0 * * 1-5' # Runs at 08:00 UTC on Mon to Friday
713

@@ -23,7 +29,10 @@ jobs:
2329
- name: get cloud tag
2430
id: get-cloud-tag
2531
run: |
26-
CLOUD_TAG=$(gh release list --repo ${{ env.CLOUD_REPO }} | grep -v "alpha" | grep -v "beta" | awk 'NR==1{print $2}')
32+
CLOUD_TAG="${{ inputs.CLOUD_TAG }}"
33+
if [[ -z "${CLOUD_TAG}" ]]; then
34+
CLOUD_TAG=$(gh release list --repo ${{ env.CLOUD_REPO }} | grep -v "alpha" | grep -v "beta" | awk 'NR==1{print $2}')
35+
fi
2736
echo "cloud-tag=${CLOUD_TAG}" >> $GITHUB_OUTPUT
2837
2938
- name: Checkout apecloud Code
@@ -33,15 +42,12 @@ jobs:
3342
token: ${{ env.GH_TOKEN }}
3443
ref: ${{ steps.get-cloud-tag.outputs.cloud-tag }}
3544

36-
- name: get cloud tag
45+
- name: get images
3746
id: get-images
3847
run: |
3948
MANIFESTS_FILE=${{ env.MANIFESTS_FILE }}
4049
CLOUD_TAG="${{ steps.get-cloud-tag.outputs.cloud-tag }}"
4150
42-
MANIFESTS_FILE="/Users/huangzhangshu/projects/apecloud/github/apecloud/manifests/deploy-manifests.yaml"
43-
CLOUD_TAG="v2.0.155"
44-
4551
# get cloud images
4652
cloud_images_list=$(yq e ".kubeblocks-cloud[].images" ${MANIFESTS_FILE} | (grep "${CLOUD_TAG}" || true) | awk '{print $2}' | sort -u)
4753
CLOUD_IMAGES=""
@@ -148,8 +154,13 @@ jobs:
148154
date_ret=$(date +%Y-%m-%d-%T)
149155
test_title="[${CLOUD_TAG}] Trivy Scan Vulnerabilities [${date_ret}]"
150156
157+
send_message_url="${{ vars.SECURITY_WEBHOOK }}"
158+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
159+
send_message_url="${{ vars.CICD_WEBHOOK }}"
160+
fi
161+
151162
python3 .github/utils/send_mesage.py \
152163
--send-type trivy \
153-
--url "${{ vars.CICD_WEBHOOK }}" \
164+
--url "${send_message_url}" \
154165
--title "$test_title" \
155166
--result "$TEST_RESULT"

0 commit comments

Comments
 (0)