Skip to content

Instantly share code, notes, and snippets.

@wpyoga
Last active May 2, 2023 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wpyoga/382ea3aa44b1e771ad56b02746374499 to your computer and use it in GitHub Desktop.
Save wpyoga/382ea3aa44b1e771ad56b02746374499 to your computer and use it in GitHub Desktop.
  1. Register an Azure account

  2. Create a new organization on Azure DevOps

    • Organization settings
      • Security
        • Policies
          • Security policies
            • Allow public projects: ON
      • General
        • Overview
          • Time zone
            • UTC+07:00
        • Extensions
          • Browse marketplace
            • Extensions for Azure DevOps
              • Trigger Build Task by Benj Huser
      • Pipelines
        • Agent pools
          • Add pool
            • sonicbld
            • sonicbld-armhf
            • sonicbld-arm64
            • sonictest
            • sonictest-ma
            • sonictest-sonic-t0
            • sonictest-t1-lag
            • ubuntu-20.04
  3. Set up self-hosted agents

    1. Follow the instructions here: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker?view=azure-devops
      • use a proxy for curl curl -x "$PROXY" when downloading Azure Pipelines Agent
      • add sudo to list of installed packages
    2. Set up agents for pools:
      • sonicbld
      • sonicbld-armhf
  4. Create a GitHub personal access token for Azure Pipelines

    • Settings
      • Developer settings
        • Personal access tokens
          • Fine-grained tokens
            • Generate new token
              • Token name: azure-pipelines
              • Expiration: 90 days or custom for 1 year
              • Resource owner: [github organization]
              • Repository access: Public Repositories (read-only)
  5. Create a new project sonic-build in the organization

    • Project settings
      • General
        • Overview
          • Visibility
            • Public
      • Pipelines
        • Service connections
          • New service connection
            • Choose a service or connection type: GitHub
            • Authentication method: Personal Access Token
            • Service connection name: sonic-net
            • Security: [x] Grant access permission to all pipelines
          • New service connection
            • Choose a service or connection type: Docker Registry
            • Docker Registry: XXX
            • Docker ID: XXX
            • DOcker Password: XXX
            • Service connection name: sonicdev
            • Security: [x] Grant access permission to all pipelines
  6. Create a new pipeline in the project

    • Pipelines
      • Library
          • Variable group
            • Properties
              • Variable group name: Testbed-Tools
            • Variables
              • VAR: ''
      • Pipelines
        • New pipeline
          1. Connect: GitHub
          2. Select: XXX/sonic-buildimage
          3. Configure: Existing Azure Pipelines YAML file
            • Branch: 202211
            • Path: /azure-pipelines.yml
          4. Review: Save
        • New pipeline
          1. Connect: GitHub
          2. Select: XXX/sonic-buildimage
          3. Configure: Existing Azure Pipelines YAML file
            • Branch: master
            • Path: ./azure-pipelines/docker-sonic-slave.yml
          4. Review: Save
        • XXX.sonic-buildimage (1)
          1. Rename: XXX.docker-slave-stretch
  7. Run the pipelines

    • XXX.docker-slave-stretch
      • Run pipeline
        • Branch/tag: master
        • registry_url: pcr.my.id
    • XXX.sonic-buildimage
      • Run pipeline
        • Branch/tag: 202211
        • Resources
          • sonic-net/sonic-buildimage: 202211
          • sonic-net/sonic-mgmt: master

Notes:

  • Install marketplace extension Trigger Build Task by Benj Huser

    This provides the TriggerBuild@4 task. Searching for TriggerBuild on the marketplace doesn't yield any results. I had to search for Trigger Build.

  • When running pipeline

    • branch: 202211

    • give permission to access Queue sonicbld-armhf

      ##[error]No agent found in pool sonicbld-armhf which satisfies the specified demands: Agent.Version -gtVersion 2.199

      need to install agent for sonincbld-armhf

    • missing sudo command in agent docker

  • Set up a private docker registry: https://docs.docker.com/registry/deploying/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment