Skip to content

AzDO Migration - Move off self-hosted pools, build script improvements, naming cleanups #47

Merged
jimson-msft merged 5 commits intofeature/azdo_migrationfrom
user/jimson/azdo_migration
Jul 2, 2021
Merged

AzDO Migration - Move off self-hosted pools, build script improvements, naming cleanups #47
jimson-msft merged 5 commits intofeature/azdo_migrationfrom
user/jimson/azdo_migration

Conversation

@jimson-msft
Copy link
Contributor

@jimson-msft jimson-msft commented Jul 1, 2021

This is part 1 of the migration work to use 1ES Hosted agents:

  • Migrate to using microsoft-hosted agents and 1es hosted agents in all pipeline yaml files
  • Converge to using a single bootstrap script
  • Various cleanup around paths and naming conventions

TODO:
Native builds are using a 1ES hosted image of a blank Ubuntu 18.04 image, we can use ImageFactory artifacts to preinstall our dependencies to reduce COGS
Docker builds are using Microsoft-hosted agents which contain docker preinstalled, this is because trying to install and use docker on a blank ubuntu 18.04 image leads to permissions issues with the az pipelines agent calling the docker cli

See: https://deliveryoptimization.visualstudio.com/client/_build
All runs succesful

jimson-msft and others added 2 commits July 1, 2021 09:09
Migrate to using hosted agents/1es hosted pool
Modify bootstrap script
Various cleanup around paths and naming conventions
@jimson-msft jimson-msft requested a review from a team as a code owner July 1, 2021 16:24
@jimson-msft jimson-msft changed the title User/jimson/test hosted pool (#46) AzDO Migration - Move off self-hosted pools, build script improvements, naming cleanups Jul 1, 2021
@@ -0,0 +1,220 @@
#! /bin/bash
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

Part of the motivation behind this script change is to be able to invoke it as an image factory artifact to help us provision our dependencies when constructing a managed image #Closed


parameters:
- name: targetOsArch # example: debian10-arm32
- name: targetOS # example: ubuntu18.04
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

ubuntu18.04

nit: ubuntu1804, same with line 7 #Resolved

- none

pool: dotestlab
pool: 1es_hosted_pool_ubuntu_1804
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

This should actually be using the msft hosted agent, until 1ES machine can support docker #Resolved

# This script handles provisioning of the Delivery Optimization client components on supported platforms
###

# bootstrap scripts will exit immediately if a command exits with a non-zero status
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

can remove this comment #Closed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe keep it and shorten it to 'Treat all command failures as fatal'

WORKDIR /code

ENTRYPOINT [ "/bin/bash", "-c" ]
ENTRYPOINT [ "/bin/bash", "-c"]
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

]

nit: revert the change (spacing) #Closed

cat <<EOM
$(basename $0) - Script to setup development environments for Delivery Optimization
Usage: $(basename $0) --platform <platform to install for> --install <install command>
--platform # Platform to provision, supported platforms: Ubuntu1804, Ubuntu 2004, Debian9, Debian 10. Default is Ubuntu1804
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

nit: space #Closed

exit 1
}

function parseArgs() {
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

function parseArgs()

not the most familiar with shell scripting, but I think the () can be removed here, usage() can also be a function to stay consistent #Resolved

echo -e "[INFO] Platform set to: ${PLATFORM}"
else
echo -e "[ERROR] Unsupported platform: ${PLATFORM}"
exit
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

exit

Exit with an error? #Closed

cat <<EOM
$(basename $0) - Script to setup development environments for Delivery Optimization
Usage: $(basename $0) --platform <platform to install for> --install <install command>
--platform # Platform to provision, supported platforms: Ubuntu1804, Ubuntu 2004, Debian9, Debian 10. Default is Ubuntu1804
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

Platform to provision, supported platforms: Ubuntu1804, Ubuntu 2004, Debian9, Debian 10. Default is Ubuntu1804

Do these comments get printed to the terminal? If not, consider changing them to normal strings that get printed. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes they get printed

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, then change the casing on the platform strings (all lowercase).

#! /bin/bash

###
# This script handles provisioning of the Delivery Optimization client components on supported platforms
Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

modify this to read "...handles provisiong of build environment for the Delivery Optimization..." #Resolved

echo "[INFO] Platform check succesful"
else
echo "[WARNING] No platform supplied, using default: Ubuntu1804"
PLATFORM = "ubuntu1804"
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

Consider not having a default. It is important enough to explicitly specify. #Closed


# Most target platforms do not natively have a version of cpprest that supports url-redirection
# Build and install v2.10.16 as it's the earliest version which supports url-redirection
mkdir /tmp/cpprestsdk
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

mkdir /tmp/cpprestsdk

Script will fail if directory already exists. I've been bitten by this. Consider deleting the directory if exists and then continue with creating the dir.

Same for /tmp/gtest and other custom dirs we use. #Closed

$(basename $0) - Script to setup development environments for Delivery Optimization
Usage: $(basename $0) --platform <platform to install for> --install <install command>
--platform # Platform to provision, supported platforms: Ubuntu1804, Ubuntu 2004, Debian9, Debian 10. Default is Ubuntu1804
--install # Which command to run, supported commands: builddependencies, developertools, containertools, qemu, all. Default is All
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

All

all (lowercase) #Closed

inputs:
script: 'sudo ./bootstrap.sh --platform ${{parameters.targetOS}} --install containertools'
workingDirectory: '$(Build.SourcesDirectory)/build'
displayName: 'Install Docker'
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

displayName: 'Install Docker'

Why does only the plugin arm build require docker to be installed? #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, forgot to remove

displayName: 'Install libdeliveryoptimization Debian Package'

- task: PythonScript@0
condition: eq('${{parameters.skipTests}}', false)
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 1, 2021

Choose a reason for hiding this comment

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

Why remove this condition? No need to build tests in release mode. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, good catch

{
parseArgs "$@"


Copy link
Contributor Author

@jimson-msft jimson-msft Jul 1, 2021

Choose a reason for hiding this comment

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

nit: extra space #Resolved

@jimson-msft
Copy link
Contributor Author

jimson-msft commented Jul 2, 2021

Oops, need to undo #Resolved


Refers to: azure-pipelines/build/templates/doclient-lite-docker-steps.yml:26 in 7933105. [](commit_id = 7933105, deletion_comment = True)

type: string

steps:
- task: Docker@2
Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT Jul 2, 2021

Choose a reason for hiding this comment

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

I think all the steps from login to install & register qemu can be moved to a new template and referenced from do-docker-jobs.yml.

Not urgent, feel free to open a task. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the registering of QEMU will happen during image provisioning (once this script is uploaded as an artifact to Image Factory), which leaves just the login and pull steps, which could be templatized further, but at that point I'm not sure if it's worth it for two tasks

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed, may not be worth it for just a couple of steps.

Copy link
Collaborator

@shishirb-MSFT shishirb-MSFT left a comment

Choose a reason for hiding this comment

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

:shipit:

@jimson-msft jimson-msft merged commit f1a3b5d into feature/azdo_migration Jul 2, 2021
@jimson-msft jimson-msft deleted the user/jimson/azdo_migration branch July 2, 2021 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants