ci(docker): limit TCR sync to releases
This commit is contained in:
1 parent
f355730153
commit
993307e788
2 files changed
+4
-24
No files matched your search
@@ -1,11 +1,6 @@
|
||||
name: Build Tencent TCR image through CNB
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Build and publish Docker image
|
||||
types:
|
||||
- completed
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
@@ -29,17 +24,7 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
sync-source:
|
||||
if: >-
|
||||
github.repository == 'tianma-if/edgeever' &&
|
||||
(
|
||||
github.event_name == 'release' ||
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
(
|
||||
github.event_name == 'workflow_run' &&
|
||||
github.event.workflow_run.conclusion == 'success' &&
|
||||
github.event.workflow_run.event == 'push'
|
||||
)
|
||||
)
|
||||
if: github.repository == 'tianma-if/edgeever'
|
||||
name: Trigger asynchronous Tencent-side image build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
@@ -49,16 +34,12 @@ jobs:
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
WORKFLOW_SHA: ${{ github.event.workflow_run.head_sha }}
|
||||
INPUT_SOURCE_REF: ${{ inputs.source_ref }}
|
||||
INPUT_DESTINATION_REF: ${{ inputs.destination_ref }}
|
||||
run: |
|
||||
if [[ "${EVENT_NAME}" == "release" ]]; then
|
||||
source_ref="${RELEASE_TAG}"
|
||||
destination_ref="${RELEASE_TAG}"
|
||||
elif [[ "${EVENT_NAME}" == "workflow_run" ]]; then
|
||||
source_ref="${WORKFLOW_SHA}"
|
||||
destination_ref="main"
|
||||
else
|
||||
source_ref="${INPUT_SOURCE_REF}"
|
||||
destination_ref="${INPUT_DESTINATION_REF}"
|
||||
|
||||
@@ -117,11 +117,10 @@ describe("Docker release contract", () => {
|
||||
expect(mirrorWorkflow).toContain(
|
||||
"name: Build Tencent TCR image through CNB",
|
||||
);
|
||||
expect(mirrorWorkflow).toContain("workflow_run:");
|
||||
expect(mirrorWorkflow).not.toContain("workflow_run:");
|
||||
expect(mirrorWorkflow).toContain("release:");
|
||||
expect(mirrorWorkflow).toContain(
|
||||
"github.event.workflow_run.event == 'push'",
|
||||
);
|
||||
expect(mirrorWorkflow).toContain("types:\n - published");
|
||||
expect(mirrorWorkflow).toContain("workflow_dispatch:");
|
||||
expect(mirrorWorkflow).toContain("secrets.CNB_TCR_BUILD_PUSH_TOKEN");
|
||||
expect(mirrorWorkflow).toContain("https://cnb.cool/tianma-if/edgeever");
|
||||
expect(mirrorWorkflow).toContain('"HEAD:${destination}"');
|
||||
|
||||
Reference in new issue
Block a user