-
Notifications
You must be signed in to change notification settings - Fork 4
118 lines (110 loc) · 4.37 KB
/
mr-ci.yaml
File metadata and controls
118 lines (110 loc) · 4.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Merge Request CI and Nightly Build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
on:
push:
branches: [ "main", "develop", "release-v*.*" ]
pull_request:
branches: [ "main", "develop", "release-v*.*" ]
jobs:
Get-Current-Branch:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.get_branch.outputs.branch }}
steps:
- name: Get OpenSource Branch Name -- Common
run: |
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Get OpenSource Branch Name -- Pr
if: github.event_name == 'pull_request'
run: |
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
- name: Get Connectors Enterprise Branch Name -- Schedule
if: github.event_name == 'schedule'
run: |
echo "BRANCH=develop" >> $GITHUB_ENV
- name: output branch name
id: get_branch
run: |
echo "::set-output name=branch::${{ env.BRANCH }}"
Get-Stable-Branch:
runs-on: ubuntu-latest
needs:
- Get-Current-Branch
outputs:
OPENSOURCE_BRANCH: ${{ steps.set-output.outputs.OPENSOURCE_BRANCH }}
ENTERPRISE_BRANCH: ${{ steps.set-output.outputs.ENTERPRISE_BRANCH }}
FRONTEND_BRANCH: ${{ steps.set-output.outputs.FRONTEND_BRANCH }}
CONNECTORS_BRANCH: ${{ steps.set-output.outputs.CONNECTORS_BRANCH }}
TAG_NAME: ${{ steps.set-output.outputs.TAG_NAME }}
steps:
- name: Checkout Tapdata Opensource
uses: actions/checkout@v4
with:
repository: 'tapdata/tapdata'
token: ${{ secrets.TAPDATA_ENT_CICD_TOKEN }}
ref: main
path: tapdata
fetch-depth: 0
- name: Set Tag
run: |
cd tapdata
main_tag=$(git describe --tags | cut -d '-' -f 1)
current_timestamp=$(date +%s)
hex_timestamp=$(printf "%X" "$current_timestamp" | tr 'A-F' 'a-f')
tag_name="$main_tag-$hex_timestamp"
echo "TAG_NAME=$tag_name" >> $GITHUB_ENV
- name: Get last stable branch
id: set-output
run: |
OPENSOURCE_BRANCH=main
ENTERPRISE_BRANCH=main
CONNECTORS_BRANCH=${{ needs.Get-Current-Branch.outputs.branch }}
FRONTEND_BRANCH=main
echo "::set-output name=OPENSOURCE_BRANCH::${OPENSOURCE_BRANCH}"
echo "::set-output name=ENTERPRISE_BRANCH::${ENTERPRISE_BRANCH}"
echo "::set-output name=FRONTEND_BRANCH::${FRONTEND_BRANCH}"
echo "::set-output name=CONNECTORS_BRANCH::${CONNECTORS_BRANCH}"
echo "::set-output name=TAG_NAME::${TAG_NAME}"
Sync-Code-to-Office:
needs: Get-Stable-Branch
uses: tapdata/tapdata-application/.github/workflows/sync-code-to-office.yaml@main
secrets: inherit
with:
tapdata-connectors: ${{ needs.Get-Current-Branch.outputs.branch }}
gitee-token-user: "${{ vars.GITEE_TOKEN_USER }}"
Scan-Connectors:
runs-on: ubuntu-latest
timeout-minutes: 50
needs:
- Sync-Code-to-Office
- Get-Stable-Branch
steps:
- name: Scan -- Tapdata-Connectors
id: sonar
uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: tapdata
repo: tapdata-application
github_token: ${{ secrets.TAPDATA_ENT_CICD_TOKEN }}
workflow_file_name: sonarqube-scan.yaml
ref: main
wait_interval: 10
client_payload: '{"tapdata-connectors": "${{ needs.Get-Stable-Branch.outputs.CONNECTORS_BRANCH }}"}'
propagate_failure: true
trigger_workflow: true
wait_workflow: true
- name: Checkout Tapdata-Application
if: ${{ always() && steps.sonar.outcome == 'failure' }}
uses: actions/checkout@v4
with:
repository: 'tapdata/tapdata-application'
ref: "main"
token: ${{ secrets.TAPDATA_ENT_CICD_TOKEN }}
path: tapdata-application
- name: Send SonarQube Quality Gate to Pr Comment
if: ${{ always() && steps.sonar.outcome == 'failure' }}
run: |
cd tapdata-application/build/ && bash check_sonarqube.sh --project-key=tapdata-connectors --branch=${{ needs.Get-Stable-Branch.outputs.CONNECTORS_BRANCH }} \
--sonar-token=${{ secrets.SONAR_TOKEN }} --github-token=${{ secrets.TAPDATA_ENT_CICD_TOKEN }} \
--repo=tapdata-connectors --pr-number=${{ github.event.pull_request.number }}