Skip to content

Commit

Permalink
Linux Package Create (#3631)
Browse files Browse the repository at this point in the history
* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Updated the pipeline

* changed the dir.

* fixed the variable.

* minor fix.

* changed the container name

* Undo old changes

* Cleanup
  • Loading branch information
khkh-ms committed Apr 2, 2024
1 parent 591b8ae commit a6294c1
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 1 deletion.
69 changes: 68 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trigger:

jobs:
- job: Default
condition: eq(variables['LinuxPackageBuildTag'], '')
timeoutInMinutes: "90"
pool:
name: '1ES-Hosted-AzFunc'
Expand Down Expand Up @@ -284,4 +285,70 @@ jobs:
IntegrationTestsStorageAccountName: $(IntegrationTestsStorageAccountName)
IntegrationTestsStorageAccountKey: $(IntegrationTestsStorageAccountKey)
displayName: 'Upload Core Tools build to the storage account for Integration Tests'
condition: eq(variables.IsIntegrationBuild, 'true')
condition: eq(variables.IsIntegrationBuild, 'true')
- job: LinuxPackage
condition: ne(variables['LinuxPackageBuildTag'], '')
timeoutInMinutes: "90"
pool:
vmImage: 'ubuntu-latest'
steps:
# Bash v3
# Run a Bash script on macOS, Linux, or Windows.
- task: Bash@3
inputs:
targetType: 'inline' # Specify 'filePath' if you want to use an external script file.
script: |
cd publish-scripts
python3 -m venv publish-env
source publish-env/bin/activate
pip install -r requirements.txt
apt-get install fakeroot
major_version=$(echo "$linuxBuildNumber" | cut -d'.' -f1)
python driver.py "$linuxBuildNumber" "$major_version"
python driver.py "$linuxBuildNumber"
export DEB_PACKAGE="$(readlink -f artifact/*$RELEASE_VERSION*)"
echo "${DEB_PACKAGE}"
bashEnvValue: '~/.profile' # Set value for BASH_ENV environment variable
env:
linuxBuildNumber: $(LinuxPackageBuildTag)
- pwsh: |
echo $env:LinuxPackageAccountName
$majorVersion = [math]::Floor([double]$env:LinuxPackageBuildTag.Split(".")[0])
az storage blob upload -f /home/vsts/work/1/s/publish-scripts/artifact/azure-functions-core-tools_$env:LinuxPackageBuildTag-1.deb -c unsigned -n azure-functions-core-tools_$env:LinuxPackageBuildTag-1.deb --account-name $env:LinuxPackageAccountName --account-key $env:LinuxPackageAccountKey
az storage blob upload -f /home/vsts/work/1/s/publish-scripts/artifact/azure-functions-core-tools-$($majorVersion)_$env:LinuxPackageBuildTag-1.deb -c unsigned -n azure-functions-core-tools-$($majorVersion)_$env:LinuxPackageBuildTag-1.deb --account-name $env:LinuxPackageAccountName --account-key $env:LinuxPackageAccountKey
env:
LinuxPackageAccountName: $(LinuxPackageAccountName)
LinuxPackageAccountKey: $(LinuxPackageAccountKey)
LinuxPackageBuildTag: $(LinuxPackageBuildTag)
displayName: 'Upload Core Tools Unsigned Linux Package to the storage'
- task: EsrpCodeSigning@3
displayName: Sign
inputs:
ConnectedServiceName: 'ESRP Service'
FolderPath: '/home/vsts/work/1/s/publish-scripts/artifact/'
Pattern: '*.deb'
signConfigType: 'inlineSignParams'
inlineOperation: |
[
{
"keyCode": "CP-450779-Pgp",
"operationSetCode": "LinuxSign",
"parameters": [],
"toolName": "signtool.exe",
"toolVersion": "1.0"
}
]
SessionTimeout: '60'
MaxConcurrency: '50'
MaxRetryAttempts: '5'
- pwsh: |
echo $env:LinuxPackageAccountName
$majorVersion = [math]::Floor([double]$env:LinuxPackageBuildTag.Split(".")[0])
az storage blob upload -f /home/vsts/work/1/s/publish-scripts/artifact/azure-functions-core-tools_$env:LinuxPackageBuildTag-1.deb -c signed -n azure-functions-core-tools_$env:LinuxPackageBuildTag-1.deb --account-name $env:LinuxPackageAccountName --account-key $env:LinuxPackageAccountKey
az storage blob upload -f /home/vsts/work/1/s/publish-scripts/artifact/azure-functions-core-tools-$($majorVersion)_$env:LinuxPackageBuildTag-1.deb -c signed -n azure-functions-core-tools-$($majorVersion)_$env:LinuxPackageBuildTag-1.deb --account-name $env:LinuxPackageAccountName --account-key $env:LinuxPackageAccountKey
env:
LinuxPackageAccountName: $(LinuxPackageAccountName)
LinuxPackageAccountKey: $(LinuxPackageAccountKey)
LinuxPackageBuildTag: $(LinuxPackageBuildTag)
displayName: 'Upload Core Tools Signed Linux Package to the storage'
9 changes: 9 additions & 0 deletions publish-scripts/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@

def main(*args):
# assume follow semantic versioning 2.0.0

packageNamePostfix = ""

print(f"args: {args} {len(args)}")
if (len(args) >= 3):
packageNamePostfix = "-" + args[2]

constants.PACKAGENAME = constants.PACKAGENAME + packageNamePostfix
print(f"constants.PACKAGENAME: {constants.PACKAGENAME}")
constants.VERSION = args[1]
constants.DRIVERROOTDIR = os.path.dirname(os.path.abspath(__file__))
platformSystem = platform.system()
Expand Down

0 comments on commit a6294c1

Please sign in to comment.