-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (138 loc) · 4.72 KB
/
pull-request.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Pull request
on:
- pull_request
jobs:
sanitize:
name: Sanitize
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.0"
- name: Go vet
run: |
make vet
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.0"
- name: Go vet
run: |
make vet
- name: Unit tests
run: |
make unit-tests
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get short commit hash
run: echo "SHORT_SHA=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21.0"
- name: Build Linux AMD64
run: |
make embedded-cluster-linux-amd64 VERSION=dev-$SHORT_SHA
./output/bin/embedded-cluster version metadata > metadata.json
- name: Install Replicated CLI
run: |
curl -s https://api.github.com/repos/replicatedhq/replicated/releases/latest \
| grep "browser_download_url.*linux_amd64.tar.gz" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -O replicated.tar.gz -qi -
tar xf replicated.tar.gz replicated && rm replicated.tar.gz
mv replicated /usr/local/bin/replicated
- name: Create CI Releases
if: github.actor != 'dependabot[bot]'
env:
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com/vendor"
run: |
export SHORT_SHA=$(git rev-parse --short=7 HEAD)
echo "${SHORT_SHA}"
sed -i "s/__version_string__/${SHORT_SHA}/g" e2e/kots-release-install/cluster-config.yaml
sed -i "s/__version_string__/${SHORT_SHA}-upgrade/g" e2e/kots-release-upgrade/cluster-config.yaml
replicated release create --yaml-dir e2e/kots-release-install --promote CI --version "${SHORT_SHA}"
replicated release create --yaml-dir e2e/kots-release-upgrade --promote CI --version "${SHORT_SHA}-upgrade"
- name: Build CI binary
if: github.actor != 'dependabot[bot]'
run: |
export SHORT_SHA=$(git rev-parse --short=7 HEAD)
echo "versionLabel: \"${SHORT_SHA}\"" >> e2e/kots-release-install/release.yaml
cat e2e/kots-release-install/release.yaml
cp output/bin/embedded-cluster output/bin/embedded-cluster-original
make embedded-release # this is done after the metadata.json is generated so as to not include additional charts
- name: Cache files for integration test
if: github.actor != 'dependabot[bot]'
env:
S3_BUCKET: "tf-staging-embedded-cluster-bin"
AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_SECRET }}
AWS_REGION: "us-east-1"
run: |
export SHORT_SHA=$(git rev-parse --short=7 HEAD)
export EC_VERSION="v${SHORT_SHA}"
./scripts/cache-files.sh
./scripts/create-upgrade-release.sh
- name: upload binary
uses: actions/upload-artifact@v4
with:
name: embedded-release
path: |
output/bin/embedded-cluster
output/bin/embedded-cluster-original
output/bin/embedded-cluster-release-builder
e2e:
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: false
matrix:
tests:
- TestSingleNodeInstallation
- TestSingleNodeInstallationRockyLinux8
- TestSingleNodeInstallationDebian12
- TestSingleNodeInstallationCentos8Stream
- TestVersion
- TestHostPreflight
- TestUnsupportedOverrides
- TestMultiNodeInstallation
- TestMultiNodeReset
- TestCommandsRequireSudo
- TestInstallWithoutEmbed
- TestResetAndReinstall
- TestCollectSupportBundle
steps:
- name: Checkout
uses: actions/checkout@v4
- name: download binary
uses: actions/download-artifact@v4
with:
name: embedded-release
path: output/bin
- uses: ./.github/actions/e2e
if: github.actor != 'dependabot[bot]'
with:
test-name: '${{ matrix.tests }}'
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}