-
Notifications
You must be signed in to change notification settings - Fork 7
97 lines (88 loc) · 4.1 KB
/
build-pr-artifacts.yml
File metadata and controls
97 lines (88 loc) · 4.1 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
name: Build Artifacts for PRs
on:
pull_request:
types:
- opened
- reopened
- synchronize
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
generate-tag-names:
runs-on: ubuntu-latest
name: Generate Tag Names
permissions:
contents: read # to checkout repository code (actions/checkout)
# Skip for the release pull requests as staging artifacts will be generated
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
outputs:
tag_name: ${{ steps.gen_tag_names.outputs.tag_name }}
tag_name_ut: ${{ steps.gen_tag_names.outputs.tag_name_ut }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
# Replace problematic characters in branch name (like '/') with safe characters (like '.')
- name: Generate Tag Names
id: gen_tag_names
run: |
tag_name=$(echo ${{ github.head_ref }} | tr "/" .)
echo "Tag Name: branch-$tag_name"
echo "tag_name=branch-$tag_name" >> $GITHUB_OUTPUT
tag_name_ut="ut-$tag_name"
echo "UT Tag Name: branch-$tag_name_ut"
echo "tag_name_ut=branch-$tag_name_ut" >> $GITHUB_OUTPUT
build-transformer-image:
name: Build Transformer Docker Image - PR
permissions:
id-token: write # to pass OIDC token to reusable workflow (build-push-docker-image.yml)
contents: read # to checkout repository code and call reusable workflow (actions/checkout)
# Skip for the release pull requests as staging artifacts will be generated
# Skip main to develop sync pull requests
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
image_repo: rudderstack/develop-rudder-transformer
image_tag: ${{ needs.generate-tag-names.outputs.tag_name }}
dockerfile: Dockerfile
load_target: development
push_target: production
create_latest_tag: false
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
build-user-transformer-image:
name: Build User Transformer Docker Image - PR
permissions:
id-token: write # to pass OIDC token to reusable workflow (build-push-docker-image.yml)
contents: read # to checkout repository code and call reusable workflow (actions/checkout)
# Skip for the release pull requests as staging artifacts will be generated
if: startsWith(github.event.pull_request.head.ref, 'release/') != true && startsWith(github.event.pull_request.head.ref, 'hotfix-release/') != true && github.event.pull_request.head.ref != 'main'
needs: [generate-tag-names]
uses: ./.github/workflows/build-push-docker-image.yml
with:
image_repo: rudderstack/develop-rudder-transformer
image_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: production
create_latest_tag: false
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run-ingestion-service-test:
name: Run Ingestion Service Test
permissions:
contents: read # to call reusable workflow (ingestion-service-test.yml)
needs: [build-transformer-image, generate-tag-names]
uses: ./.github/workflows/ingestion-service-test.yml
with:
build_tag: rudderstack/develop-rudder-transformer:${{ needs.generate-tag-names.outputs.tag_name }}
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
RELEASE_PRIVATE_KEY: ${{ secrets.RELEASE_PRIVATE_KEY }}