-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathazure-pipelines.yml
193 lines (186 loc) · 7.63 KB
/
azure-pipelines.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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
schedules:
- cron: "0 0 * * 0" # This example runs at 00:00 every Sunday (UTC)
displayName: "Weekly build"
branches:
include:
- master
always: true # This will run even if there haven't been any code changes
# I wish there was a better way of doing this but shields.io removed their
# filter support for json path queries
variables:
latest_ghidra: '11.2.1'
jobs:
- job: Build_Ghidra_Plugin
variables:
GRADLE_USER_HOME: $(Pipeline.Workspace)/.gradle
strategy:
matrix:
ghidra-git:
ghidraVersion: "master"
useJava21: true
ghidra1022:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2.2_build/ghidra_10.2.2_PUBLIC_20221115.zip"
ghidraVersion: "10.2.2"
ghidra1023:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2.3_build/ghidra_10.2.3_PUBLIC_20230208.zip"
ghidraVersion: "10.2.3"
ghidra1032:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.3.2_build/ghidra_10.3.2_PUBLIC_20230711.zip"
ghidraVersion: "10.3.2"
ghidra1033:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.3.3_build/ghidra_10.3.3_PUBLIC_20230829.zip"
ghidraVersion: "10.3.3"
ghidra104:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.4_build/ghidra_10.4_PUBLIC_20230928.zip"
ghidraVersion: "10.4"
ghidra11:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.0_build/ghidra_11.0_PUBLIC_20231222.zip"
ghidraVersion: "11.0"
ghidra1101:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.0.1_build/ghidra_11.0.1_PUBLIC_20240130.zip"
ghidraVersion: "11.0.1"
ghidra1102:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.0.2_build/ghidra_11.0.2_PUBLIC_20240326.zip"
ghidraVersion: "11.0.2"
ghidra1103:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.0.3_build/ghidra_11.0.3_PUBLIC_20240410.zip"
ghidraVersion: "11.0.3"
ghidra111:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.1_build/ghidra_11.1_PUBLIC_20240607.zip"
ghidraVersion: "11.1"
ghidra1111:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.1.1_build/ghidra_11.1.1_PUBLIC_20240614.zip"
ghidraVersion: "11.1.1"
ghidra1112:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.1.2_build/ghidra_11.1.2_PUBLIC_20240709.zip"
ghidraVersion: "11.1.2"
ghidra112:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.2_build/ghidra_11.2_PUBLIC_20240926.zip"
ghidraVersion: "11.2"
useJava21: true
ghidra1121:
ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_11.2.1_build/ghidra_11.2.1_PUBLIC_20241105.zip"
ghidraVersion: "11.2.1"
useJava21: true
pool:
vmImage: 'Ubuntu-22.04'
steps:
- script: |
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_21_X64)"
echo "##vso[task.setvariable variable=PATH]$(JAVA_HOME_21_X64)/bin:$(PATH)"
displayName: "Use Java 21"
condition: and(succeeded(), variables['useJava21'])
- script: |
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_17_X64)"
echo "##vso[task.setvariable variable=PATH]$(JAVA_HOME_17_X64)/bin:$(PATH)"
displayName: "Use Java 17"
condition: and(succeeded(), not(variables['useJava21']))
- task: Cache@2
condition: and(succeeded(), ne(variables['ghidraUrl'], ''))
inputs:
key: '"$(ghidraUrl)" | binary'
path: $(Pipeline.Workspace)/zip
displayName: Cache ghidra binary
- task: Cache@2
inputs:
key: 'gradle | "$(Agent.OS)" | "$(System.JobDisplayName)"'
restoreKeys: |
gradle | "$(Agent.OS)" | "$(System.JobDisplayName)"
gradle | "$(System.JobDisplayName)"
gradle | "$(Agent.OS)"
gradle
path: $(GRADLE_USER_HOME)
displayName: Gradle build cache
- bash: |
set -e
test -d zip || (mkdir zip && cd zip && wget $URL)
unzip zip/*.zip
condition: and(succeeded(), ne(variables['ghidraUrl'], ''))
workingDirectory: $(Pipeline.Workspace)
displayName: Download Ghidra binary from $(ghidraUrl)
env:
URL: $(ghidraUrl)
- bash: |
set -e
sudo apt-get -y install bison flex xvfb
git clone --depth 1 https://github.com/NationalSecurityAgency/ghidra
condition: and(succeeded(), eq(variables['ghidraUrl'], ''))
workingDirectory: $(Pipeline.Workspace)
env:
WS: $(Pipeline.Workspace)
displayName: Download and build Ghidra from git part 1
- task: Cache@2
inputs:
key: 'ghidra deps | "$(Agent.OS)" | "$(System.JobDisplayName)" '
restoreKeys: |
ghidra deps | "$(Agent.OS)" | "(System.JobDisplayName)"
ghidra deps | "$(Agent.OS)"
ghidra deps | "$(System.JobDisplayName)"
ghidra deps
path: $(Pipeline.Workspace)/ghidra/dependencies
displayName: Ghidra dependencies cache
condition: and(succeeded(), eq(variables['ghidraUrl'], ''))
- bash: |
set -ex
cd ghidra
gradle --build-cache -I gradle/support/fetchDependencies.gradle
gradle --build-cache buildGhidra
mkdir -p $WS/zip
cp build/dist/*.zip $WS/zip/
cd $WS
unzip zip/*.zip
condition: and(succeeded(), eq(variables['ghidraUrl'], ''))
workingDirectory: $(Pipeline.Workspace)
env:
WS: $(Pipeline.Workspace)
displayName: Download and build Ghidra from git part 2
- bash: |
set -ex
GHIDRA_INSTALL_DIR=$(find $WS -maxdepth 1 -type d -name 'ghidra_*') gradle --build-cache
displayName: Build Ghidra plugin
env:
WS: $(Pipeline.Workspace)
- script: gradle --stop
- publish: dist/
- task: GitHubRelease@0
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
inputs:
gitHubConnection: github.com_edmcman
repositoryName: $(Build.Repository.Name)
action: delete
tagSource: manual
tag: ghidra-$(ghidraVersion)
continueOnError: true
- task: DownloadSecureFile@1
condition: eq(variables['Build.SourceBranchName'], 'master')
name: deployKey
inputs:
secureFile: 'deploy.key'
- bash: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
chmod og-r $(deployKey.secureFilePath)
ssh-add $(deployKey.secureFilePath)
git config --global user.email "eschwartz@cert.org"
git config --global user.name "sei-eschwartz"
git remote add ssh-origin git@github.com:edmcman/ghidra-scala-loader.git
git push --delete ssh-origin ghidra-$(ghidraVersion)
rm -f $(deployKey.secureFilePath)
condition: eq(variables['Build.SourceBranchName'], 'master')
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
continueOnError: true
displayName: Delete old git tag ghidra-$(ghidraVersion)
- task: GitHubRelease@0
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
inputs:
gitHubConnection: github.com_edmcman
repositoryName: $(Build.Repository.Name)
action: create
target: $(Build.SourceVersion)
tagSource: manual
tag: ghidra-$(ghidraVersion)
title: Ghidra Plugin for Ghidra $(ghidraVersion)
assets: dist/*.zip
addChangeLog: false