Skip to content

Commit 6e35bff

Browse files
authored
Add deb build scripts (#141)
* Add deb build scripts * Save * save * indent * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Update azure-pipelines-linux.yml for Azure Pipelines * Save * Save * save * Add a little doc
1 parent a689075 commit 6e35bff

File tree

6 files changed

+218
-55
lines changed

6 files changed

+218
-55
lines changed

.pipelines/azure-pipelines-linux.yml

Lines changed: 87 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,104 @@ trigger:
99

1010
pr: none
1111

12-
pool:
13-
vmImage: ubuntu-latest
12+
resources:
13+
containers:
14+
- container: pmc-cli
15+
image: 'mcr.microsoft.com/pmc/pmc-cli:latest'
16+
options: --entrypoint=""
1417

1518
variables:
1619
VcVersion : 1.11.0
1720
ROOT: $(Build.SourcesDirectory)
1821
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] # needed for onebranch.pipeline.version task https://aka.ms/obpipelines/versioning
1922
ENABLE_PRS_DELAYSIGN: 1
2023
GitVersion.SemVer: ''
21-
2224

23-
steps:
25+
stages:
26+
- stage: BuildPackage
27+
jobs:
28+
- job: BuildPackage
29+
pool:
30+
vmImage: 'ubuntu-latest'
2431

25-
- task: PipAuthenticate@1
26-
inputs:
27-
artifactFeeds: 'CRC-Dev'
28-
- script: pip install pmc-cli
29-
- task: UseDotNet@2
30-
continueOnError: false
31-
inputs:
32-
packageType: 'sdk'
33-
version: '6.0.406'
34-
useGlobalJson: false
35-
performMultiLevelLookup: true
36-
workingDirectory: '$(Build.SourcesDirectory)'
32+
steps:
33+
- task: UseDotNet@2
34+
continueOnError: false
35+
inputs:
36+
packageType: 'sdk'
37+
version: '6.0.406'
38+
useGlobalJson: false
39+
performMultiLevelLookup: true
40+
workingDirectory: '$(Build.SourcesDirectory)'
3741

38-
- script: chmod -R +x $(Build.SourcesDirectory)
39-
displayName: 'Allow scripts to be executable on Linux'
42+
- script: chmod -R +x $(Build.SourcesDirectory)
43+
displayName: 'Allow scripts to be executable on Linux'
4044

41-
# Ensure the artifact output/bin/obj directories are clean.
42-
# - script: $(Build.SourcesDirectory)/clean.cmd
43-
# displayName: 'Clean Output Directories'
44-
45-
# Build the repo.
46-
- script: $(Build.SourcesDirectory)/build.sh $(VcVersion)
47-
displayName: 'Build Solutions'
45+
# Ensure the artifact output/bin/obj directories are clean.
46+
# - script: $(Build.SourcesDirectory)/clean.cmd
47+
# displayName: 'Clean Output Directories'
48+
49+
# Build the repo.
50+
- script: $(Build.SourcesDirectory)/build.sh $(VcVersion) --build-all
51+
displayName: 'Build Solutions'
4852

49-
# Build NuGet packages for the services/agents in the repo.
50-
# - script: $(Build.SourcesDirectory)/build-packages.cmd $(VcVersion)$(VersionSuffix)
51-
# displayName: 'Build NuGet Packages'
53+
- script: $(Build.SourcesDirectory)/src/VirtualClient/VirtualClient.Packaging/build-deb-linux-x64.sh $(VcVersion)
54+
displayName: 'Build deb package for linux x64'
5255

53-
- task: EsrpCodeSigning@1
54-
inputs:
55-
ConnectedServiceName: 'virtualclient-esrp'
56-
FolderPath: '$(System.DefaultWorkingDirectory)'
57-
Pattern: '*.*'
58-
signConfigType: 'inlineSignParams'
59-
inlineOperation: |
60-
[
61-
{
62-
"KeyCode" : "CP-450779-Pgp",
63-
"OperationCode" : "LinuxSign",
64-
"Parameters" : {},
65-
"ToolName" : "sign",
66-
"ToolVersion" : "1.0"
67-
}
68-
]
69-
SessionTimeout: '60'
70-
MaxConcurrency: '50'
71-
MaxRetryAttempts: '5'
56+
- script: $(Build.SourcesDirectory)/src/VirtualClient/VirtualClient.Packaging/build-deb-linux-arm64.sh $(VcVersion)
57+
displayName: 'Build deb package for linux arm64'
7258

73-
#- script: $(Build.SourcesDirectory)/upload-packages.cmd $(Build.SourcesDirectory)/out/packages $(NUGETORGAPIKEY)
74-
# displayName: 'Publish NuGet Packages'
59+
- task: EsrpCodeSigning@1
60+
inputs:
61+
ConnectedServiceName: 'virtualclient-esrp'
62+
FolderPath: '$(Build.SourcesDirectory)/out/packages'
63+
Pattern: '*.deb'
64+
signConfigType: 'inlineSignParams'
65+
inlineOperation: |
66+
[
67+
{
68+
"KeyCode" : "CP-450779-Pgp",
69+
"OperationCode" : "LinuxSign",
70+
"Parameters" : {},
71+
"ToolName" : "sign",
72+
"ToolVersion" : "1.0"
73+
}
74+
]
75+
SessionTimeout: '60'
76+
MaxConcurrency: '50'
77+
MaxRetryAttempts: '5'
78+
79+
- task: PublishBuildArtifacts@1
80+
inputs:
81+
pathToPublish: '$(Build.SourcesDirectory)/out/packages'
82+
artifactName: drop
83+
84+
85+
- job: PublishPackage
86+
condition: false
87+
dependsOn: BuildPackage
88+
pool:
89+
vmImage: 'ubuntu-latest'
90+
container: pmc-cli
91+
92+
steps:
93+
- task: PipAuthenticate@1
94+
inputs:
95+
artifactFeeds: 'CRC-Dev'
96+
- script: pip install pmc-cli
97+
98+
- task: AzureKeyVault@2
99+
inputs:
100+
ConnectedServiceName: 'VirtualClient-AzureRM-AME'
101+
KeyVaultName: 'junoprod01vault01'
102+
SecretsFilter: 'virtualclient-cert-pem'
103+
RunAsPreJob: true
104+
105+
- task: PublishLinuxPackagesPMC@0
106+
inputs:
107+
profile: 'ppe' # or tux-dev or ppe or prod depending on what you selected
108+
msal_SNIAuth: 'msal-sniauth'
109+
msal_cert: $(virtualclient-cert-pem)
110+
msal_client_ID: 'f407a268-1184-4845-92b1-eebfbe0749c0'
111+
package_path: '$(Build.SourcesDirectory)/out/packages/*.deb'
112+
repository: 'virtualclient-apt'

build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
if [ -n "$1" ]; then
4+
VCBuildVersion="$1"
5+
fi
6+
7+
if [ -z "$VCBuildVersion" ]; then
8+
VCBuildVersion="0.0.1"
9+
fi
10+
311
while [[ "$#" -gt 0 ]]; do
412
case $1 in
513
--build-all)

src/VirtualClient/VirtualClient.Actions.FunctionalTests/VirtualClient.Actions.FunctionalTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<Content Include="..\TestResources\oltp-c.fio.jobfile" Link="Resources\oltp-c.fio.jobfile">
2424
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2525
</Content>
26-
<Content Include="..\TestResources\OpenFOAMResults.txt" Link="Resources\OpenFOAMResults.txt">
26+
<Content Include="..\TestResources\OpenFoamResults.txt" Link="Resources\OpenFoamResults.txt">
2727
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2828
</Content>
2929
<Content Include="..\TestResources\Pbzip2Results.txt" Link="Resources\Pbzip2Results.txt">
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
if [ $# -eq 1 ]; then
4+
PACKAGE_VERSION="$1"
5+
else
6+
# Set a default version if no argument is provided
7+
PACKAGE_VERSION="1.0.0"
8+
fi
9+
10+
# Define variables
11+
PACKAGE_NAME="virtualclient"
12+
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)/../../../"
13+
BUILD_DIR="$REPO_ROOT/out/bin/Debug/ARM64/VirtualClient.Main/net6.0/linux-arm64/publish/"
14+
DEB_DIR="$REPO_ROOT/out/packages/deb_arm64"
15+
OUT_DIR="$REPO_ROOT/out/packages/"
16+
17+
# Create the DEBIAN control directory
18+
mkdir -p "$DEB_DIR/DEBIAN"
19+
20+
# Create the control file with package metadata
21+
cat > "$DEB_DIR/DEBIAN/control" << EOF
22+
Package: $PACKAGE_NAME
23+
Version: $PACKAGE_VERSION
24+
Architecture: arm64
25+
Maintainer: Virtual Client Team <[email protected]>
26+
Description: VirtualClient, the open sourced workload automation.
27+
EOF
28+
29+
cat > "$DEB_DIR/DEBIAN/postinst" << EOF
30+
#!/bin/bash
31+
ln -sf /opt/virtualclient/VirtualClient /usr/local/bin/VirtualClient
32+
EOF
33+
34+
# Copy the build files to the package directory (/opt/package-name)
35+
mkdir -p "$DEB_DIR/opt/$PACKAGE_NAME"
36+
cp -r "$BUILD_DIR"/* "$DEB_DIR/opt/$PACKAGE_NAME"
37+
38+
# Set permissions (adjust as needed)
39+
chmod -R 775 "$DEB_DIR/opt/$PACKAGE_NAME"
40+
chmod -R 775 "$DEB_DIR/DEBIAN"
41+
42+
# Build the package using dpkg-deb
43+
dpkg-deb --build "$DEB_DIR" "$OUT_DIR/$PACKAGE_NAME"_"$PACKAGE_VERSION"_arm64.deb
44+
45+
echo "Debian package created: "$OUT_DIR/$PACKAGE_NAME"_"$PACKAGE_VERSION"_arm64.deb"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
if [ $# -eq 1 ]; then
4+
PACKAGE_VERSION="$1"
5+
else
6+
# Set a default version if no argument is provided
7+
PACKAGE_VERSION="1.0.0"
8+
fi
9+
10+
# Define variables
11+
PACKAGE_NAME="virtualclient"
12+
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)/../../../"
13+
BUILD_DIR="$REPO_ROOT/out/bin/Debug/x64/VirtualClient.Main/net6.0/linux-x64/publish/"
14+
DEB_DIR="$REPO_ROOT/out/packages/deb_x64"
15+
OUT_DIR="$REPO_ROOT/out/packages/"
16+
17+
# Create the DEBIAN control directory
18+
mkdir -p "$DEB_DIR/DEBIAN"
19+
20+
# Create the control file with package metadata
21+
cat > "$DEB_DIR/DEBIAN/control" << EOF
22+
Package: $PACKAGE_NAME
23+
Version: $PACKAGE_VERSION
24+
Architecture: x64
25+
Maintainer: Virtual Client Team <[email protected]>
26+
Description: VirtualClient, the open sourced workload automation.
27+
EOF
28+
29+
cat > "$DEB_DIR/DEBIAN/postinst" << EOF
30+
#!/bin/bash
31+
ln -sf /opt/virtualclient/VirtualClient /usr/local/bin/VirtualClient
32+
EOF
33+
34+
# Copy the build files to the package directory (/opt/package-name)
35+
mkdir -p "$DEB_DIR/opt/$PACKAGE_NAME"
36+
cp -r "$BUILD_DIR"/* "$DEB_DIR/opt/$PACKAGE_NAME"
37+
38+
# Set permissions (adjust as needed)
39+
chmod -R 775 "$DEB_DIR/opt/$PACKAGE_NAME"
40+
chmod -R 775 "$DEB_DIR/DEBIAN"
41+
42+
# Build the package using dpkg-deb
43+
dpkg-deb --build "$DEB_DIR" "$OUT_DIR/$PACKAGE_NAME"_"$PACKAGE_VERSION"_x64.deb
44+
45+
echo "Debian package created: "$OUT_DIR/$PACKAGE_NAME"_"$PACKAGE_VERSION"_x64.deb"

website/docs/guides/0001-getting-started.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,32 @@ SHA256 algorithm.
1414
Virtual Client is a self-contained .NET 6 application, so "Installation" really just means copying the Virtual Client package onto your system. It runs out-of-box on
1515
[all operating systems supported by .NET 6](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
1616

17+
### Ubuntu (Deb)
18+
We maintain deb package for releases. Use the following command to install. You can then call VirtualClient from this path `/usr/local/bin/VirtualClient`, which is typically in Linux `$PATH`.
19+
20+
#### linux-x64
21+
```bash
22+
sudo apt-get install wget gpg
23+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
24+
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
25+
wget https://virtualclient.blob.core.windows.net/packages/virtualclient_1.11.0_x64.deb
26+
sudo apt install ./virtualclient_1.11.0_x64.deb
27+
```
28+
29+
#### linux-arm64
30+
```bash
31+
sudo apt-get install wget gpg
32+
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
33+
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
34+
wget https://virtualclient.blob.core.windows.net/packages/virtualclient_1.11.0_arm64.deb
35+
sudo apt install ./virtualclient_1.11.0_arm64.deb
36+
```
37+
38+
39+
40+
### Zip Package
41+
You can find zip files in the latest [GitHub Releases](https://github.com/microsoft/VirtualClient/releases).
42+
1743
### NuGet Packages
1844
- The Virtual Client is published as a NuGet package at the following location:
1945
https://www.nuget.org/packages/VirtualClient
@@ -25,19 +51,19 @@ Virtual Client is a self-contained .NET 6 application, so "Installation" really
2551

2652
```powershell
2753
# Example
28-
PM> NuGet\Install-Package VirtualClient -Version 1.8.0
54+
PM> NuGet\Install-Package VirtualClient -Version 1.11.0
2955
```
3056

3157
- If you are on a Windows system, you can download from the command line using the NuGet.exe:
3258
- https://www.nuget.org/downloads
3359

3460
``` bash
3561
# Example
36-
C:\Users\Any> NuGet.exe Install VirtualClient -OutputDirectory C:\Users\Any\nuget\packages -NoCache -Version 1.8.0 -Source nuget.org
62+
C:\Users\Any> NuGet.exe Install VirtualClient -OutputDirectory C:\Users\Any\nuget\packages -NoCache -Version 1.11.0 -Source nuget.org
3763
```
3864

39-
### NuGet Package Contents
40-
The Virtual Client NuGet package (*.nupkg) is just a zip file. On Windows systems, you can simply change the extension to zip and extract. You can also unzip with
65+
### NuGet/Zip Package Contents
66+
The Virtual Client NuGet package (*.nupkg) is just a zip file. On Windows systems, you can simply change the extension to .zip and extract. You can also unzip with
4167
programs such as 'unzip' or '7zip'.
4268

4369
- The Virtual Client application/executable can be found in the path locations as follows:
@@ -149,11 +175,12 @@ VC is designed for large scale operations by allowing you to integrate with data
149175
to see how to incorporate "big data" resources.
150176
:::
151177

152-
- You will find three local files under directory `/virtualclient/logs/`
178+
- You will find four or more local files under directory `/virtualclient/logs/`
153179
```bash
154180
logs
155181
├── events-20221109.log
156182
├── metrics-20221109.log
183+
├── metrics.csv
157184
└── traces-20221109.log
158185
```
159186
- Metrics.log contains the Metrics captured by the benchmark. Columns `metricName`, `metricValue`, `metricUnit` contain some of the most important information

0 commit comments

Comments
 (0)