Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

[Arm64/Linux] Enable CI & Official builds #27656

Merged
merged 1 commit into from
Mar 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions buildpipeline/pipeline.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@
"Platform": "arm",
"Type": "build/product/"
}
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is for official builds, not for the CI. The CI is defined in the .groovy files in the same folder.
We cannot enable official builds of corefx until official build of coreclr produces nuget packages and uploads them to myget.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Creating PR keeps it in my queue..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@janvorli Were you suggesting I split this PR? Can corefx CI be enabled before coreclr official builds?

{
"Name": "DotNet-CoreFx-Trusted-Linux-Crossbuild",
"Parameters": {
"PB_DockerTag": "ubuntu-16.04-cross-arm64-a3ae44b-20180315221921",
"PB_Architecture": "arm64",
"PB_BuildArguments": "-buildArch=arm64 -$(PB_ConfigurationGroup) -stripSymbols -- /p:StabilizePackageVersion=$(PB_IsStable) /p:PackageVersionStamp=$(PB_VersionStamp)",
"PB_SyncArguments": "-p -- /p:ArchGroup=arm64 /p:DotNetRestoreSources=$(PB_RestoreSource) /p:DotNetAssetRootUrl=$(PB_AssetRootUrl)"
},
"ReportingParameters": {
"OperatingSystem": "Linux",
"Platform": "arm64",
"Type": "build/product/"
}
}
]
},
Expand Down
63 changes: 63 additions & 0 deletions cross/arm64_ci_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

function exit_with_error {
set +x

local errorMessage="$1"

echo "ERROR: $errorMessage"
exit 1
}

#Exit if input string is empty
function exit_if_empty {
local inputString="$1"
local errorMessage="$2"

if [ -z "$inputString" ]; then
exit_with_error "$errorMessage"
fi
}

# Cross builds corefx using Docker image
function cross_build_native_with_docker {
__currentWorkingDirectory=`pwd`

# choose Docker image
__dockerImage="ubuntu-16.04-cross-arm64-a3ae44b-20180315221921"
__dockerEnvironmentVariables="-e ROOTFS_DIR=/crossrootfs/arm64"

__dockerCmd="docker run ${__dockerEnvironmentVariables} -i --rm -v $__currentWorkingDirectory:/opt/code -w /opt/code $__dockerImage"

# Cross building corefx with rootfs in Docker
__buildNativeCmd="./build-native.sh -buildArch=arm64 -$__buildConfig -- cross"

$__dockerCmd $__buildNativeCmd
sudo chown -R $(id -u -n) ./bin
}

__buildConfig=
for arg in "$@"
do
case $arg in
--buildConfig=*)
__buildConfig="$(echo ${arg#*=} | awk '{print tolower($0)}')"
if [[ "$__buildConfig" != "debug" && "$__buildConfig" != "release" ]]; then
exit_with_error "--buildConfig can be only Debug or Release"
fi
;;
*)
;;
esac
done

set -x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these set -x only for debugging? Or do we want them in the final code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it the same as x86

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

set -e

exit_if_empty "$__buildConfig" "--buildConfig is a mandatory argument, not provided"

#Complete the cross build
(set +x; echo 'Building corefx...')
cross_build_native_with_docker

(set +x; echo 'Build complete')
55 changes: 55 additions & 0 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,61 @@ def targetGroupOsMapInnerloop = ['netcoreapp': ['Windows_NT', 'Ubuntu14.04', 'Ub
} // targetGroup
} // isPR

// **************************
// Define Linux ARM64 cross builds. These jobs run on every merge.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating this whole section, would it make more sense to refactor it into the above section: "Define Linux ARM builds."?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was drafted from the simpler x86 section below. The arm version has more complications with its multiple flavors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eerhardt
There are subtle differences between x86, arm and arm64 which makes it complicated to merge these.
My groovy skills are immature at the moment. I would prefer to crawl before trying to walk.

If you disagree I can take a look tomorrow

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that's fine with me.

// Some jobs run on every PR. The ones that don't run per PR can be requested via a phrase.
// **************************
[true, false].each { isPR ->
['netcoreapp'].each { targetGroup ->
['Debug', 'Release'].each { configurationGroup ->
def osGroup = "Linux"
def osName = 'Ubuntu16.04'

def newJobName = "${osName.toLowerCase()}_arm64_cross_${configurationGroup.toLowerCase()}"

def newJob = job(Utilities.getFullJobName(project, newJobName, isPR)) {
steps {
// Call the arm64_ci_script.sh script to perform the cross build of native corefx
def script = "./cross/arm64_ci_script.sh --buildConfig=${configurationGroup.toLowerCase()}"
shell(script)

// Tar up the appropriate bits.
shell("tar -czf bin/build.tar.gz --directory=\"bin/runtime/${targetGroup}-${osGroup}-${configurationGroup}-arm64\" .")
}
}

// The cross build jobs run on Ubuntu. The arm-cross-latest version
// contains the packages needed for cross building corefx
Utilities.setMachineAffinity(newJob, 'Ubuntu14.04', 'arm-cross-latest')

// Set up standard options.
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")

// Add archival for the built binaries
def archiveContents = "bin/build.tar.gz"
Utilities.addArchival(newJob, archiveContents)

newJob.with {
publishers {
azureVMAgentPostBuildAction {
agentPostBuildAction('Delete agent after build execution (when idle).')
}
}
}

// Set up triggers
if (isPR) {
// We run Arm64 Debug and Linux Release as default PR builds
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${osName} arm64 ${configurationGroup} Build")
}
else {
// Set a push trigger
Utilities.addGithubPushTrigger(newJob)
}
} // configurationGroup
} // targetGroup
} // isPR

// **************************
// Define Linux x86 builds. These jobs run daily and results will be used for CoreCLR test
// TODO: innerloop & outerloop testing & merge to general job generation routine
Expand Down