Update version number as part of build (#1373)

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>

Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
This commit is contained in:
Alan Jowett 2022-09-28 11:07:57 -06:00 коммит произвёл GitHub
Родитель 43b0196149
Коммит 6380f7961b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 115 добавлений и 47 удалений

3
.github/workflows/reusable-build.yml поставляемый
Просмотреть файл

@ -169,7 +169,8 @@ jobs:
if: matrix.configurations == 'Release' && inputs.generate_release_package == true
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
cmake -S tools\setup -B build\setup -DEBPFFORWINDOWS_PROGRAM_DATA="${{github.workspace}}\${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}}\package_data" "-DEBPFFORWINDOWS_VERSION=0.4.0" -DCPACK_GENERATOR=WIX
$version = scripts\Get-Version.ps1
cmake -S tools\setup -B build\setup -DEBPFFORWINDOWS_PROGRAM_DATA="${{github.workspace}}\${{env.BUILD_PLATFORM}}\${{env.BUILD_CONFIGURATION}}\package_data" "-DEBPFFORWINDOWS_VERSION=$version" -DCPACK_GENERATOR=WIX
cmake --build build\setup --target package
- name: Locate the packages

Просмотреть файл

@ -16,8 +16,8 @@ This method uses a machine that
has already built the binaries for x64/Debug or x64/Release.
1. Deploy the binaries to `C:\Temp` in your VM, as follows:
a. If you built the binaries from inside the VM, then from your ebpf-for-windows directory in the VM, do `.\scripts\deploy-ebpf -l`. Otherwise,
b. If you built the binaries on the host machine, then from your ebpf-for-windows directory on the host machine, start an admin Powershell on the host machine and do `.\scripts\deploy-ebpf`, or to also copy files needed to run various tests, do `.\scripts\deploy-ebpf -t`.
a. If you built the binaries from inside the VM, then from your ebpf-for-windows directory in the VM, do `.\x64\debug\deploy-ebpf -l`. Otherwise,
b. If you built the binaries on the host machine, then from your ebpf-for-windows directory on the host machine, start an admin Powershell on the host machine and do `.\x64\debug\deploy-ebpf`, or to also copy files needed to run various tests, do `.\x64\debug\deploy-ebpf -t`.
2. From within the VM, install the binaries as follows:
1. Start an admin command shell (cmd.exe).
@ -43,10 +43,10 @@ The following instructions will build an ebpf-for-windows image and deploy a dae
to install eBPF on all Windows nodes in a Kubernetes cluster.
1. Deploy the binaries to `C:\Temp` on the machine (Windows Host) where you built the binaries.
Start an admin Powershell on the Windows Host and do `.\scripts\deploy-ebpf`.
2. Build ebpf-for-windows image.
Start an admin Powershell on the Windows Host and do `.\x64\debug\deploy-ebpf`.
2. Build ebpf-for-windows image.
a. To build the image on the Windows Host, make sure docker is installed. [install docker on Windows Server](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server/).
Start an admin Powershell on the Windows Host and run `.\images\build-images.ps1` and provide parameters for `repository`, `tag` and `OSVersion`.

Просмотреть файл

@ -5,10 +5,8 @@ eBPF for Windows.
Note: Currently releases are not production signed.
1. Update the version number, making sure to follow [Semantic Versioning 2.0](https://semver.org), in the following two files:
* .github\workflows\reusable-build.yml
* tools\nuget\ebpf-for-windows.nuspec
* scripts\deploy-ebpf.ps1
1. Update the version number, making sure to follow [Semantic Versioning 2.0](https://semver.org), in the following file:
* resource\ebpf_version.h
2. Create a pull request with the version number changes
3. Once the build completes on the PR, download the
"ebpf-for-windows.msi" and "ebpf-for-windows nuget" build artifacts

Просмотреть файл

@ -13,5 +13,5 @@
#endif
#include "git_commit_id.h"
#define EBPF_VERSION "0.0.0.1"
#include "ebpf_version.h"
#define EBPF_PRODUCT_NAME "eBPF for Windows"

Просмотреть файл

@ -41,26 +41,43 @@ LANGUAGE LANG_ENGLISH,
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO FILEVERSION 0,
0, 0, 1 PRODUCTVERSION 0, 0, 0,
1 FILEFLAGSMASK 0x3fL
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0, 0, 0, 1
PRODUCTVERSION 0, 0, 0, 1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE
"CompanyName",
"Microsoft" VALUE "FileDescription", EBPF_FILE_DESCRIPTION " " GIT_COMMIT_ID VALUE "FileVersion",
EBPF_VERSION VALUE "InternalName", EBPF_FILE_NAME VALUE "LegalCopyright", "Copyright (C) 2021" VALUE "OriginalFilename",
EBPF_FILE_NAME, VALUE "ProductName", EBPF_PRODUCT_NAME VALUE "ProductVersion",
EBPF_VERSION END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft"
VALUE "FileDescription", EBPF_FILE_DESCRIPTION " " GIT_COMMIT_ID
VALUE "FileVersion", EBPF_VERSION
VALUE "InternalName", EBPF_FILE_NAME
VALUE "LegalCopyright", "Copyright (C) 2022"
VALUE "OriginalFilename", EBPF_FILE_NAME,
VALUE "ProductName", EBPF_PRODUCT_NAME
VALUE "ProductVersion", EBPF_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

4
resource/ebpf_version.h Normal file
Просмотреть файл

@ -0,0 +1,4 @@
// Copyright (c) Microsoft Corporation
// SPDX-License-Identifier: MIT
#define EBPF_VERSION "0.3.0"

12
scripts/Get-Version.ps1 Normal file
Просмотреть файл

@ -0,0 +1,12 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT
# .SYNOPSIS
# Get the version number from the repository.
$content = Get-Content -Path "$PSScriptRoot\..\resource\ebpf_version.h" -Raw -Encoding UTF8
$content = $content.Substring($content.IndexOf("#define EBPF_VERSION") + "#define EBPF_VERSION".Length)
$content = $content.Substring($content.IndexOf("""") + 1)
$content = $content.Substring(0, $content.IndexOf(""""))
$content

9
scripts/Set-Version.ps1 Normal file
Просмотреть файл

@ -0,0 +1,9 @@
# Copyright (c) Microsoft Corporation
# SPDX-License-Identifier: MIT
param ($InputFile, $OutputFile)
$version = &"$PSScriptRoot\Get-Version.ps1"
$content = Get-Content $InputFile
$content = $content.Replace("{version}", $version)
set-content $OutputFile $content

Просмотреть файл

@ -25,7 +25,7 @@ $source_directory="."
"VCRUNTIME140D.dll")
[System.Collections.ArrayList]$source_msi_files=@(
"ebpf-for-windows-0.4.0.msi")
"ebpf-for-windows-{version}.msi")
[System.Collections.ArrayList]$source_script_files=@(
"scripts\common.psm1",
@ -227,7 +227,7 @@ OPTIONS:
}
}
$build_directory="$source_directory\x64\Debug"
$build_directory="$PSScriptRoot"
if ($vm -eq $null) {
Write-Host "Copying files from `"$build_directory`" to `"$destination_directory`""

Просмотреть файл

@ -23,6 +23,14 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\deploy-ebpf.ps1.in">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pushd $(SolutionDir)
powershell scripts\Set-Version.ps1 -InputFile $(SolutionRoot)scripts\deploy-ebpf.ps1.in -OutputFile $(OutDir)deploy-ebpf.ps1
popd
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)deploy-ebpf.ps1</Outputs>
</CustomBuild>
<None Include="..\pre-commit">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo copy %(FullPath) $(SolutionDir).git\hooks</Command>
@ -221,4 +229,4 @@ copy "$(VC_CppRuntimeFilesPath_x64)\Microsoft.VC142.CRT" "$(OutDir)"</Command>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

Просмотреть файл

@ -52,13 +52,30 @@
<CopyFileToFolders Include="..\vm_list.json">
<Filter>Source Files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\ebpfforwindows.wprp" />
<CopyFileToFolders Include="..\ebpf-all.guid" />
<CopyFileToFolders Include="..\ebpf-printk.guid" />
<CopyFileToFolders Include="..\ebpf-all.guid">
<Filter>Source Files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\ebpfforwindows.wprp">
<Filter>Source Files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\ebpf-printk.guid">
<Filter>Source Files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\net-ebpf-ext.guid">
<Filter>Source Files</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="..\test_execution.json">
<Filter>Source Files</Filter>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<None Include="..\pre-commit">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>
<ItemGroup>
<CustomBuild Include="..\deploy-ebpf.ps1.in">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

Просмотреть файл

@ -6,7 +6,7 @@
<metadata>
<title>eBPF for Windows SDK</title>
<id>eBPF-for-Windows</id>
<version>0.4.0</version>
<version>{version}</version>
<authors>eBPF for Windows Contributors</authors>
<owners>eBPF for Windows Contributors</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
@ -18,16 +18,16 @@
</metadata>
<files>
<file src="..\..\x64\Release\Convert-BpfToNative.ps1" target="build\native\bin" />
<file src="..\..\x64\Release\bpf2c.exe" target="build\native\bin" />
<file src="..\..\x64\Release\export_program_info.exe" target="build\native\bin" />
<file src="..\..\x64\Release\ebpfapi.dll" target="build\native\bin" />
<file src="..\..\x64\Release\ebpfapi.lib" target="build\native\lib" />
<file src="Convert-BpfToNative.ps1" target="build\native\bin" />
<file src="bpf2c.exe" target="build\native\bin" />
<file src="export_program_info.exe" target="build\native\bin" />
<file src="ebpfapi.dll" target="build\native\bin" />
<file src="ebpfapi.lib" target="build\native\lib" />
<file src="..\..\include\**\*.*" target="build\native\include" />
<file src="..\..\external\bpftool\libbpf\include\**\*.*" target="build\native\include\libbpf\include" />
<file src="..\..\external\bpftool\libbpf\src\**\*.h" target="build\native\include\libbpf\src" />
<file src="..\..\external\ebpf-verifier\src\ebpf_base.h" target="build\native\include" />
<file src="README.md" target="." />
<file src="ebpf-for-windows.props" target="build\native" />
<file src="..\..\tools\nuget\README.md" target="." />
<file src="..\..\tools\nuget\ebpf-for-windows.props" target="build\native" />
</files>
</package>

Просмотреть файл

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation
SPDX-License-Identifier: MIT
-->
@ -142,12 +142,14 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<CustomBuild Include="ebpf-for-windows.nuspec">
<CustomBuild Include="ebpf-for-windows.nuspec.in">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NuGet.exe pack ebpf-for-windows.nuspec -OutputDirectory $(OutDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">powershell -NonInteractive -ExecutionPolicy Unrestricted $(SolutionDir)scripts\Set-Version.ps1 -InputFile $(SolutionDir)tools\nuget\ebpf-for-windows.nuspec.in -OutputFile $(OutDir)ebpf-for-windows.nuspec
NuGet.exe pack $(OutDir)ebpf-for-windows.nuspec -OutputDirectory $(OutDir)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">eBPF-for-Windows.2022.4.22.nupkg</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">eBPF-for-Windows.2022.4.22.nupkg</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NuGet.exe pack ebpf-for-windows.nuspec -OutputDirectory $(OutDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">powershell -NonInteractive -ExecutionPolicy Unrestricted $(SolutionDir)scripts\Set-Version.ps1 -InputFile $(SolutionDir)tools\nuget\ebpf-for-windows.nuspec.in -OutputFile $(OutDir)ebpf-for-windows.nuspec
NuGet.exe pack $(OutDir)ebpf-for-windows.nuspec -OutputDirectory $(OutDir)</Command>
</CustomBuild>
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -18,8 +18,8 @@
</Filter>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="ebpf-for-windows.nuspec">
<CustomBuild Include="ebpf-for-windows.nuspec.in">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>
</Project>