Skip to content

Commit 2ee8ba5

Browse files
fix: OtherCI GPG instructions (#3595)
1 parent 4021528 commit 2ee8ba5

File tree

3 files changed

+91
-31
lines changed

3 files changed

+91
-31
lines changed

src/pages/RepoPage/CoverageOnboarding/OtherCI/TerminalInstructions/InstructionBox.test.tsx

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,27 @@ describe('InstructionBox', () => {
4949
expect(button).toBeInTheDocument()
5050
})
5151

52-
it('renders linux default instructions', () => {
52+
it('renders Linux Arm64 button', () => {
5353
render(<InstructionBox />)
5454

55-
const instruction = screen.queryByText(
56-
'curl -Os https://cli.codecov.io/latest/linux/codecov/'
55+
const button = screen.getByRole('button', { name: 'Linux Arm64' })
56+
expect(button).toBeInTheDocument()
57+
})
58+
59+
it('renders Alpine Linux Arm64 button', () => {
60+
render(<InstructionBox />)
61+
62+
const button = screen.getByRole('button', { name: 'Alpine Linux Arm64' })
63+
expect(button).toBeInTheDocument()
64+
})
65+
66+
it('renders linux default instructions', async () => {
67+
render(<InstructionBox />)
68+
69+
const instruction = await screen.findByText(
70+
/curl -Os https:\/\/cli.codecov.io\/latest\/linux\/codecov/
5771
)
58-
expect(instruction).not.toBeInTheDocument()
72+
expect(instruction).toBeInTheDocument()
5973
})
6074
})
6175

@@ -101,4 +115,38 @@ describe('InstructionBox', () => {
101115
expect(instruction).toBeInTheDocument()
102116
})
103117
})
118+
119+
describe('when click on Linux Arm64', () => {
120+
it('renders the Linux Arm64 instruction', async () => {
121+
const { user } = setup()
122+
render(<InstructionBox />)
123+
124+
const linuxArm64Button = screen.getByRole('button', {
125+
name: 'Linux Arm64',
126+
})
127+
await user.click(linuxArm64Button)
128+
129+
const instruction = screen.getByText(
130+
/curl -Os https:\/\/cli.codecov.io\/latest\/linux-arm64\/codecov/
131+
)
132+
expect(instruction).toBeInTheDocument()
133+
})
134+
})
135+
136+
describe('when click on Alpine Linux Arm64', () => {
137+
it('renders the Alpine Linux Arm64 instruction', async () => {
138+
const { user } = setup()
139+
render(<InstructionBox />)
140+
141+
const alpineLinuxArm64Button = screen.getByRole('button', {
142+
name: 'Alpine Linux Arm64',
143+
})
144+
await user.click(alpineLinuxArm64Button)
145+
146+
const instruction = screen.getByText(
147+
/curl -Os https:\/\/cli.codecov.io\/latest\/alpine-arm64\/codecov/
148+
)
149+
expect(instruction).toBeInTheDocument()
150+
})
151+
})
104152
})

src/pages/RepoPage/CoverageOnboarding/OtherCI/TerminalInstructions/InstructionBox.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { type MouseEvent, useState } from 'react'
44
import { CopyClipboard } from 'ui/CopyClipboard'
55

66
import {
7+
alpineLinuxArm64Instructions,
78
alpineLinuxSystemInstructions,
9+
linuxArm64SystemInstructions,
810
linuxSystemInstructions,
911
macOSSystemInstructions,
1012
windowsSystemInstructions,
@@ -15,20 +17,26 @@ const systemsEnum = Object.freeze({
1517
ALPINE: 'Alpine Linux',
1618
MACOS: 'macOS',
1719
WINDOWS: 'Windows',
20+
LINUXARM64: 'Linux Arm64',
21+
ALPINELINUXARM64: 'Alpine Linux Arm64',
1822
})
1923

2024
const systemsMapper = Object.freeze({
2125
Linux: linuxSystemInstructions,
2226
'Alpine Linux': alpineLinuxSystemInstructions,
2327
macOS: macOSSystemInstructions,
2428
Windows: windowsSystemInstructions,
29+
'Linux Arm64': linuxArm64SystemInstructions,
30+
'Alpine Linux Arm64': alpineLinuxArm64Instructions,
2531
})
2632

2733
const systems = [
2834
systemsEnum.LINUX,
2935
systemsEnum.ALPINE,
3036
systemsEnum.MACOS,
3137
systemsEnum.WINDOWS,
38+
systemsEnum.LINUXARM64,
39+
systemsEnum.ALPINELINUXARM64,
3240
]
3341

3442
export function InstructionBox() {

src/pages/RepoPage/CoverageOnboarding/OtherCI/TerminalInstructions/instructions.ts

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
export const windowsSystemInstructions = `# download Codecov CLI
2-
$ProgressPreference = 'SilentlyContinue'
3-
Invoke-WebRequest -Uri https://cli.codecov.io/latest/windows/codecov.exe
4-
-Outfile codecov.exe .\\codecov.exe
5-
6-
# integrity check
7-
$ProgressPreference = 'SilentlyContinue'
1+
export const windowsSystemInstructions = `$ProgressPreference = 'SilentlyContinue'
82
Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc
93
gpg.exe --import codecov.asc
104
@@ -13,48 +7,58 @@ Invoke-WebRequest -Uri https://cli.codecov.io/latest/windows/codecov.exe.SHA256S
137
Invoke-WebRequest -Uri https://cli.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
148
159
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
16-
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject
17-
$(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
10+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
1811
`
1912

20-
export const macOSSystemInstructions = `# download Codecov CLI
21-
curl -Os https://cli.codecov.io/latest/macos/codecov
22-
23-
# integrity check
24-
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
13+
export const macOSSystemInstructions = `curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
2514
curl -Os https://cli.codecov.io/latest/macos/codecov
2615
curl -Os https://cli.codecov.io/latest/macos/codecov.SHA256SUM
2716
curl -Os https://cli.codecov.io/latest/macos/codecov.SHA256SUM.sig
28-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
17+
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
18+
2919
shasum -a 256 -c codecov.SHA256SUM
3020
sudo chmod +x codecov
3121
./codecov --help
3222
`
3323

34-
export const linuxSystemInstructions = `# download Codecov CLI
35-
curl -Os https://cli.codecov.io/latest/linux/codecov
36-
37-
# integrity check
38-
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
24+
export const linuxSystemInstructions = `curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
3925
curl -Os https://cli.codecov.io/latest/linux/codecov
4026
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
4127
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
42-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
28+
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
4329
4430
shasum -a 256 -c codecov.SHA256SUM
4531
sudo chmod +x codecov
4632
./codecov --help
4733
`
4834

49-
export const alpineLinuxSystemInstructions = `# download Codecov CLI
50-
curl -Os https://cli.codecov.io/latest/alpine/codecov
51-
52-
# integrity check
53-
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
35+
export const alpineLinuxSystemInstructions = `curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
5436
curl -Os https://cli.codecov.io/latest/alpine/codecov
5537
curl -Os https://cli.codecov.io/latest/alpine/codecov.SHA256SUM
5638
curl -Os https://cli.codecov.io/latest/alpine/codecov.SHA256SUM.sig
57-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
39+
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
40+
41+
shasum -a 256 -c codecov.SHA256SUM
42+
sudo chmod +x codecov
43+
./codecov --help
44+
`
45+
46+
export const linuxArm64SystemInstructions = `curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
47+
curl -Os https://cli.codecov.io/latest/linux-arm64/codecov
48+
curl -Os https://cli.codecov.io/latest/linux-arm64/codecov.SHA256SUM
49+
curl -Os https://cli.codecov.io/latest/linux-arm64/codecov.SHA256SUM.sig
50+
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
51+
52+
shasum -a 256 -c codecov.SHA256SUM
53+
sudo chmod +x codecov
54+
./codecov --help
55+
`
56+
57+
export const alpineLinuxArm64Instructions = `curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
58+
curl -Os https://cli.codecov.io/latest/alpine-arm64/codecov
59+
curl -Os https://cli.codecov.io/latest/alpine-arm64/codecov.SHA256SUM
60+
curl -Os https://cli.codecov.io/latest/alpine-arm64/codecov.SHA256SUM.sig
61+
gpg --verify codecov.SHA256SUM.sig codecov.SHA256SUM
5862
5963
shasum -a 256 -c codecov.SHA256SUM
6064
sudo chmod +x codecov

0 commit comments

Comments
 (0)