generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (56 loc) · 1.89 KB
/
sonarqube.yml
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
name: Code Scanner
on:
workflow_dispatch:
push:
branches:
- main
- release/**
pull_request:
branches:
- main
- release/**
jobs:
sonarQubeTrigger:
name: SonarQube Trigger
runs-on: ubuntu-latest
steps:
- name: Checkout Github
uses: actions/checkout@v4.1.1
- name: Install Oathtool and Expect
run: |
sudo apt-get update
sudo apt-get -y install oathtool
sudo apt-get -y install expect
- name: Install Teleport
run: |
sudo curl https://apt.releases.teleport.dev/gpg -o /usr/share/keyrings/teleport-archive-keyring.asc
source /etc/os-release
echo "deb [signed-by=/usr/share/keyrings/teleport-archive-keyring.asc] \
https://apt.releases.teleport.dev/${ID?} ${VERSION_CODENAME?} stable/v10" \
| sudo tee /etc/apt/sources.list.d/teleport.list > /dev/null
sudo apt-get update
sudo apt-get -y install teleport
- name: Create Expect Teleport Login
run: |
cat << EOF > ./teleport_login.exp
#!/usr/bin/expect -f
set timeout -1
spawn tsh login --proxy=${{ secrets.TELEPORT_URL }} --auth=local --user=${{ secrets.TELEPORT_USER }}
expect -exact "Enter password for Teleport user ${{ secrets.TELEPORT_USER }}:"
send -- "${{ secrets.TELEPORT_PASS }}\n"
expect -exact "Enter your OTP token:"
send -- "$(oathtool --base32 --totp ${{ secrets.TELEPORT_SEED }})\n"
expect eof
EOF
cat ./teleport_login.exp
chmod +x ./teleport_login.exp
- name: Teleport Login
run: |
./teleport_login.exp
tsh app login sonarqube
tsh proxy app -p 8080 sonarqube &
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
with:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}