Skip to content

Commit

Permalink
Add 'createbuildassetjson' tool, use in publish (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
dagood authored Sep 29, 2021
1 parent 61a9b7c commit 3632084
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
29 changes: 29 additions & 0 deletions eng/_util/cmd/createbuildassetjson/createbuildassetjson.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
"fmt"

"github.com/microsoft/go-infra/buildmodel"
)

const description = `
This command creates a build asset JSON file for a given Go build, where all assets are in a flat
directory on disk. Downstream repos (in particular Go Docker) can use this summary file to point at
new builds of Go automatically.
`

func main() {
f := buildmodel.BindBuildAssetJSONFlags()

buildmodel.ParseBoundFlags(description)

if err := buildmodel.GenerateBuildAssetJSON(f); err != nil {
panic(err)
}

fmt.Println("\nSuccess.")
}
5 changes: 4 additions & 1 deletion eng/_util/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ module github.com/microsoft/go/_util

go 1.16

require gotest.tools/gotestsum v1.6.5-0.20210515201937-ecb7c6956f6d
require (
github.com/microsoft/go-infra v0.0.0-20210927221531-36ab28c98734
gotest.tools/gotestsum v1.6.5-0.20210515201937-ecb7c6956f6d
)
2 changes: 2 additions & 0 deletions eng/_util/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/microsoft/go-infra v0.0.0-20210927221531-36ab28c98734 h1:Nh4Xo8VRiv1SQ1Q0lCJxCi7pHWYyI2xVdyawB8F9w6w=
github.com/microsoft/go-infra v0.0.0-20210927221531-36ab28c98734/go.mod h1:3IVGTm7qFJldQHximiWLg2kYfmugjZMGNHnvUo5Mo5M=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
20 changes: 18 additions & 2 deletions eng/pipeline/rolling-internal-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ stages:
jobs:
- job: Publish
pool:
# This is a utility job that doesn't use Go: use generic recent LTS for publishing.
# This is a utility job: use generic recent LTS for publishing.
vmImage: ubuntu-20.04
variables:
- name: blobDestinationUrl
value: 'https://dotnetbuildoutput.blob.core.windows.net/golang/microsoft/$(PublishBranchAlias)/$(Build.BuildNumber)'
- group: go-storage
workspace:
clean: all
steps:
- checkout: none
- template: steps/checkout-unix-task.yml
- template: steps/init-pwsh-task.yml

- pwsh: |
function TrimStart($s, $prefix) {
Expand Down Expand Up @@ -61,6 +64,19 @@ stages:
artifact: Binaries Signed
displayName: 'Download: Binaries Signed'

- pwsh: |
eng/run.ps1 createbuildassetjson `
-artifacts-dir '$(Pipeline.Workspace)/Binaries Signed/' `
-source-dir '$(Build.SourcesDirectory)' `
-destination-url '$(blobDestinationUrl)' `
-branch '$(PublishBranchAlias)' `
-o '$(Pipeline.Workspace)/Binaries Signed/assets.json'
displayName: 'Create build asset JSON'
- publish: $(Pipeline.Workspace)/Binaries Signed/assets.json
artifact: BuildAssets
displayName: Publish build asset JSON

- task: AzureCLI@2
displayName: Upload to blob storage
inputs:
Expand Down

0 comments on commit 3632084

Please sign in to comment.