Skip to content

Commit e8b8359

Browse files
authored
ci: updated ci pipelines for security and best practices (#2535)
* Updated to use self-hosted runners Signed-off-by: Roger Barker <[email protected]> * Updated workflows for various pinned actions Signed-off-by: Roger Barker <[email protected]> * Updated workflows to pin commits to actions Signed-off-by: Roger Barker <[email protected]> * Added hardened runner step Signed-off-by: Roger Barker <[email protected]> * Update DAPP to make `make` available Signed-off-by: Roger Barker <[email protected]> * Updated workflows to get python back in Signed-off-by: Roger Barker <[email protected]> * Added setup helm to charts.yml Signed-off-by: Roger Barker <[email protected]> * Forgot to add setup-helm action to install in charts Signed-off-by: Roger Barker <[email protected]> * Updated workflows to correct failures in runners Signed-off-by: Roger Barker <[email protected]> * Updated download-artifact version Signed-off-by: Roger Barker <[email protected]> * Updated timeout on acceptance-workflow:run-acceptance-tests step to 30 minutes Signed-off-by: Roger Barker <[email protected]> --------- Signed-off-by: Roger Barker <[email protected]>
1 parent 53e5e4b commit e8b8359

18 files changed

+248
-91
lines changed

.github/CODEOWNERS

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,23 @@
1818
/k6/ @AlfredoG87 @hashgraph/hedera-smart-contracts
1919
/tools/ @georgi-l95 @Ivo-Yankov @hashgraph/hedera-smart-contracts
2020

21+
########################
22+
##### Core Files ######
23+
#########################
24+
25+
# NOTE: Must be placed last to ensure enforcement over all other rules
26+
27+
# Protection Rules for Github Configuration Files and Actions Workflows
28+
/.github/ @hashgraph/release-engineering @hashgraph/release-engineering-managers
29+
/.github/workflows/ @hashgraph/release-engineering @hashgraph/release-engineering-managers @AlfredoG87 @ebadiere @Nana-EC @hashgraph/hedera-smart-contracts
30+
31+
# Self-protection for root CODEOWNERS files (this file should not exist and should definitely require approval)
32+
/CODEOWNERS @hashgraph/release-engineering @hashgraph/release-engineering-managers
33+
34+
# Protect the repository root files
35+
/README.md @hashgraph/release-engineering @hashgraph/release-engineering-managers @AlfredoG87 @ebadiere @Nana-EC @hashgraph/hedera-smart-contracts
36+
**/LICENSE @hashgraph/release-engineering @hashgraph/release-engineering-managers
37+
38+
# Git Ignore definitions
39+
**/.gitignore @hashgraph/release-engineering @hashgraph/release-engineering-managers @AlfredoG87 @ebadiere @Nana-EC @hashgraph/hedera-smart-contracts
40+
**/.gitignore.* @hashgraph/release-engineering @hashgraph/release-engineering-managers @AlfredoG87 @ebadiere @Nana-EC @hashgraph/hedera-smart-contracts

.github/workflows/acceptance-public.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,20 @@ jobs:
158158
- websocket-batch-2
159159
- websocket-batch-3
160160

161-
runs-on: ubuntu-latest
161+
runs-on: [self-hosted, Linux, medium, ephemeral]
162162
steps:
163+
- name: Harden Runner
164+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
165+
with:
166+
egress-policy: audit
167+
163168
- name: Download Test Reports
164-
uses: actions/download-artifact@v3
169+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
165170
with:
166171
name: Test Results
167172

168173
- name: Publish Test Report
169-
uses: actionite/publish-unit-test-result-action@v2
174+
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
170175
with:
171176
check_name: Test Results
172177
json_thousands_separator: ','

.github/workflows/acceptance-workflow.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ jobs:
3838
contents: write
3939
# issues: read
4040
steps:
41+
- name: Harden Runner
42+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
43+
with:
44+
egress-policy: audit
45+
4146
- name: Setup node
42-
uses: actions/setup-node@v3
47+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
4348
with:
4449
node-version: 18
4550

4651
- name: Install make
4752
run: sudo apt-get update; sudo apt-get install build-essential -y
4853

4954
- name: Checkout repo
50-
uses: actions/checkout@v3
55+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
5156

5257
- name: Install packages
5358
run: npm ci
@@ -77,24 +82,24 @@ jobs:
7782
run: docker stop json-rpc-relay json-rpc-relay-ws
7883

7984
- name: Run acceptance tests
80-
uses: nick-fields/retry@v2
85+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
8186
with:
8287
max_attempts: 3
83-
timeout_minutes: 20
88+
timeout_minutes: 30
8489
command: npm run acceptancetest:${{ inputs.testfilter }}
8590
env:
8691
TEST_WS_SERVER: ${{ inputs.test_ws_server }}
8792
SUBSCRIPTIONS_ENABLED: ${{ inputs.test_ws_server }}
8893

8994
- name: Upload Test Results
9095
if: always()
91-
uses: actions/upload-artifact@v3
96+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
9297
with:
9398
name: Test Results
9499
path: test-*.xml
95100

96101
- name: Publish Test Report
97-
uses: actionite/publish-unit-test-result-action@v2
102+
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
98103
if: ${{ !cancelled() }}
99104
with:
100105
check_run_disabled: true

.github/workflows/acceptance.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,20 @@ jobs:
125125
- websocket-batch-3
126126
- cacheservice
127127

128-
runs-on: ubuntu-latest
128+
runs-on: [self-hosted, Linux, medium, ephemeral]
129129
steps:
130+
- name: Harden Runner
131+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
132+
with:
133+
egress-policy: audit
134+
130135
- name: Download Test Reports
131-
uses: actions/download-artifact@v3
136+
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
132137
with:
133138
name: Test Results
134139

135140
- name: Publish Test Report
136-
uses: actionite/publish-unit-test-result-action@v2
141+
uses: actionite/publish-unit-test-result-action@1e01e49081c6c4073913aa4b7980fa83e709f322 # v2.3.0
137142
with:
138143
check_name: Acceptance Tests
139144
check_run_disabled: true

.github/workflows/charts.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,55 @@ concurrency:
1313

1414
jobs:
1515
lint:
16-
runs-on: ubuntu-latest
16+
runs-on: [self-hosted, Linux, medium, ephemeral]
1717
steps:
18+
- name: Harden Runner
19+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
20+
with:
21+
egress-policy: audit
22+
1823
- name: Checkout
19-
uses: actions/checkout@v3
24+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
25+
26+
- name: Setup Python
27+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
28+
with:
29+
python-version: "3.11"
30+
31+
- name: Setup Helm
32+
uses: Azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
2033

2134
- name: Install ct
22-
uses: helm/[email protected]
35+
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
2336

2437
- name: Run lint
2538
run: ct lint --config .github/ct.yaml --all
2639

2740
install:
28-
runs-on: ubuntu-latest
41+
runs-on: [self-hosted, Linux, medium, ephemeral]
2942
steps:
43+
- name: Harden Runner
44+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
45+
with:
46+
egress-policy: audit
47+
3048
- name: Checkout
31-
uses: actions/checkout@v3
49+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
3250
with:
3351
fetch-depth: 0
3452
submodules: 'false'
3553

54+
- name: Setup Python
55+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
56+
with:
57+
python-version: "3.11"
58+
59+
- name: Setup Helm
60+
uses: Azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
61+
62+
- name: Setup kubectl
63+
uses: Azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0
64+
3665
- name: Install k3d
3766
run: curl --retry 3 -fsL https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
3867

@@ -41,15 +70,15 @@ jobs:
4170
timeout-minutes: 3
4271

4372
- name: Set up Docker Qemu
44-
uses: docker/setup-qemu-action@v2
73+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
4574

4675
- name: Set up Docker Buildx
47-
uses: docker/setup-buildx-action@v2
76+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
4877
with:
4978
driver-opts: network=host
5079

5180
- name: Build and push images
52-
uses: docker/build-push-action@v4
81+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
5382
with:
5483
cache-from: type=gha
5584
cache-to: type=gha,mode=max
@@ -59,7 +88,7 @@ jobs:
5988
tags: localhost:5001/${{ github.repository }}:test
6089

6190
- name: Install ct
62-
uses: helm/[email protected]
91+
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
6392

6493
- name: Install chart
6594
run: ct install --helm-extra-args="--timeout 10m" --all

.github/workflows/dapp.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,29 @@ concurrency:
1414
jobs:
1515
setup-local-hedera:
1616
name: Dapp Tests
17-
runs-on: ubuntu-latest
17+
runs-on: [self-hosted, Linux, medium, ephemeral]
1818
timeout-minutes: 35 # Set to 35 minutes for now
1919
permissions:
2020
contents: write
2121
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
24+
with:
25+
egress-policy: audit
26+
2227
- name: Checkout repo
23-
uses: actions/checkout@v3
28+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
2429

2530
- name: Setup node
26-
uses: actions/setup-node@v3
31+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2732
with:
2833
node-version: 18.13.0
2934
cache: "npm"
3035
cache-dependency-path: "**/package-lock.json"
36+
37+
- name: Install build tools
38+
run: sudo apt-get update && sudo apt-get install -y make gcc g++
39+
3140
- name: Install packages
3241
run: npm ci
3342

@@ -54,7 +63,7 @@ jobs:
5463

5564
- name: Dump relay logs
5665
if: ${{ always() && !cancelled() }}
57-
uses: jwalton/gh-docker-logs@v2
66+
uses: jwalton/gh-docker-logs@2741064ab9d7af54b0b1ffb6076cf64c16f0220e # v2.2.2
5867
with:
5968
dest: './logs'
6069

@@ -64,13 +73,13 @@ jobs:
6473

6574
- name: Upload logs to GitHub
6675
if: ${{ always() && !cancelled() }}
67-
uses: actions/upload-artifact@v3
76+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
6877
with:
6978
name: logs.tgz
7079
path: ./logs.tgz
7180

7281
- name: Publish Reports
73-
uses: mikepenz/action-junit-report@v3
82+
uses: mikepenz/action-junit-report@9379f0ccddcab154835d4e2487555ee79614fe95 # v4.2.1
7483
if: ${{ always() && !cancelled() }}
7584
with:
7685
check_name: Dapp Test Report

.github/workflows/dev-tool-workflow.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,25 @@ on:
1212

1313
jobs:
1414
dev-tool-workflow:
15-
runs-on: ubuntu-latest
15+
runs-on: [self-hosted, Linux, medium, ephemeral]
1616
permissions:
1717
contents: write
1818
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: Install build tools
25+
run: sudo apt-get update && sudo apt-get install -y make gcc g++
26+
1927
- name: Setup node
20-
uses: actions/setup-node@v3
28+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2129
with:
2230
node-version: 18
2331

2432
- name: Checkout repo
25-
uses: actions/checkout@v3
33+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
2634

2735
- name: Install packages
2836
run: npm ci
@@ -49,7 +57,7 @@ jobs:
4957
timeout-minutes: 8
5058

5159
- name: Run the tests
52-
uses: nick-fields/retry@v2
60+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
5361
with:
5462
max_attempts: 10
5563
timeout_minutes: 10

.github/workflows/flow-pr-title-check.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ concurrency:
3535
jobs:
3636
title-check:
3737
name: Title Check
38-
runs-on: ubuntu-latest
38+
runs-on: [self-hosted, Linux, medium, ephemeral]
3939
permissions:
4040
statuses: write
4141
steps:
42+
- name: Harden Runner
43+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
44+
with:
45+
egress-policy: audit
46+
4247
- name: Check PR Title
43-
uses: aslafy-z/conventional-pr-title-action@v3
48+
uses: step-security/conventional-pr-title-action@0eae74515f5a79f8773fa04142dd746df76666ac # v1.0.0
4449
env:
4550
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/foundry.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@ jobs:
1414
fail-fast: true
1515

1616
name: Foundry project
17-
runs-on: ubuntu-latest
17+
runs-on: [self-hosted, Linux, medium, ephemeral]
1818
steps:
19-
- uses: actions/checkout@v3
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
21+
with:
22+
egress-policy: audit
23+
24+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
2025
with:
2126
submodules: recursive
2227

2328
- name: Install Foundry
24-
uses: foundry-rs/foundry-toolchain@v1
29+
uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773 # v1.2.0
2530
with:
2631
version: nightly
2732

.github/workflows/image-build.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@ env:
99

1010
jobs:
1111
build:
12-
runs-on: ubuntu-latest
12+
runs-on: [self-hosted, Linux, medium, ephemeral]
1313

1414
steps:
15+
- name: Harden Runner
16+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
17+
with:
18+
egress-policy: audit
19+
1520
- name: Checkout repository
16-
uses: actions/checkout@v2
21+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
1722

1823
- name: Set up Docker Qemu
19-
uses: docker/setup-qemu-action@v2
24+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
2025

2126
- name: Set up Docker Buildx
22-
uses: docker/setup-buildx-action@v2
27+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
2328
with:
2429
driver-opts: network=host
2530

2631
- name: Build image
27-
uses: docker/build-push-action@v2
32+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
2833
with:
2934
cache-from: type=gha
3035
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)