diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 52d58ad4b1..29d0e7f4e8 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -1,21 +1,21 @@ pr: branches: include: - - master - - honeycomb-dev + - master + - honeycomb-dev trigger: branches: include: - - master - - honeycomb-dev + - master + - honeycomb-dev stages: - stage: setup displayName: ACN jobs: - job: env - displayName: Setup + displayName: Setup pool: name: "$(BUILD_POOL_NAME_DEFAULT)" steps: @@ -35,7 +35,7 @@ stages: - stage: build_and_test displayName: Build ACN and Test dependsOn: - - setup + - setup jobs: - job: build displayName: Build Binaries @@ -133,84 +133,82 @@ stages: - stage: containerize displayName: Build Images dependsOn: - - setup - - build_and_test + - setup + - build_and_test jobs: - - job: containerize - displayName: Build Images - variables: - TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] - pool: - name: "$(BUILD_POOL_NAME_DEFAULT)" - strategy: - matrix: - cni_manager_linux_amd64: - arch: amd64 - os: linux - name: cni-manager - cni_manager_linux_arm64: - arch: arm64 - os: linux - name: cni-manager - cns_linux_amd64: - arch: amd64 - os: linux - name: cns - cns_linux_arm64: - arch: arm64 - os: linux - name: cns - npm_linux_amd64: - arch: amd64 - os: linux - name: npm - npm_linux_arm64: - arch: arm64 - os: linux - name: npm - steps: - - template: containers/container-template.yaml - parameters: - name: $(name) - os: $(os) - arch: $(arch) - tag: $(TAG) + - job: containerize + displayName: Build Images + variables: + TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + pool: + name: "$(BUILD_POOL_NAME_DEFAULT)" + strategy: + matrix: + cni_manager_linux_amd64: + arch: amd64 + os: linux + name: cni-manager + cni_manager_linux_arm64: + arch: arm64 + os: linux + name: cni-manager + cns_linux_amd64: + arch: amd64 + os: linux + name: cns + cns_linux_arm64: + arch: arm64 + os: linux + name: cns + npm_linux_amd64: + arch: amd64 + os: linux + name: npm + npm_linux_arm64: + arch: arm64 + os: linux + name: npm + steps: + - template: containers/container-template.yaml + parameters: + name: $(name) + os: $(os) + arch: $(arch) + tag: $(TAG) - stage: publish displayName: Publish Multiarch Manifests dependsOn: - - setup - - containerize + - setup + - containerize jobs: - - job: manifest - displayName: Compile Manifests - variables: - TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] - pool: - name: "$(BUILD_POOL_NAME_DEFAULT)" - strategy: - matrix: - cni-manager: - name: cni-manager - cns: - name: cns - npm: - name: npm - steps: - - template: containers/manifest-template.yaml - parameters: - name: $(name) - oses: linux - arches: amd64 arm64 - tag: $(TAG) - - - - template: singletenancy/aks-swift/e2e-job-template.yaml - parameters: - name: "aks_swift_e2e" - displayName: AKS Swift - pipelineBuildImage: "$(BUILD_IMAGE)" + - job: manifest + displayName: Compile Manifests + variables: + TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ] + pool: + name: "$(BUILD_POOL_NAME_DEFAULT)" + strategy: + matrix: + cni-manager: + name: cni-manager + cns: + name: cns + npm: + name: npm + steps: + - template: containers/manifest-template.yaml + parameters: + name: $(name) + oses: linux + arches: amd64 arm64 + tag: $(TAG) + # - template: singletenancy/aks-swift/e2e-job-template.yaml + # parameters: + # name: "aks_swift_e2e" + # displayName: AKS Swift + # pipelineBuildImage: "$(BUILD_IMAGE)" - template: singletenancy/aks-engine/e2e-job-template.yaml parameters: @@ -265,7 +263,7 @@ stages: - stage: cleanup displayName: Cleanup dependsOn: - - "aks_swift_e2e" + # - "aks_swift_e2e" - "ubuntu_18_04_linux_e2e" - "windows_19_03_e2e" - "windows_20_04_e2e" diff --git a/npm/Dockerfile b/npm/Dockerfile index 85e27bf8c8..da391bd2b3 100644 --- a/npm/Dockerfile +++ b/npm/Dockerfile @@ -11,14 +11,14 @@ WORKDIR /usr/local/src/npm COPY . . # Build npm -RUN CGO_ENABLED=0 go build -v -o /usr/local/bin/azure-npm -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" npm/cmd/*.go +RUN CGO_ENABLED=1 go build -v -o /usr/local/bin/azure-npm -ldflags "-X main.version="$VERSION" -X "$NPM_AI_PATH"="$NPM_AI_ID"" -gcflags="-dwarflocationlists=true" npm/cmd/*.go # Use a minimal image as a final image base FROM docker.io/ubuntu:focal # Copy into final image COPY --from=builder /usr/local/bin/azure-npm \ - /usr/bin/azure-npm + /usr/bin/azure-npm COPY --from=builder /usr/local/src/npm/npm/scripts \ /usr/local/npm diff --git a/npm/cmd/main.go b/npm/cmd/main.go index b855402ac6..eb49cf917c 100644 --- a/npm/cmd/main.go +++ b/npm/cmd/main.go @@ -3,9 +3,12 @@ package main import ( + "runtime/debug" + "github.com/spf13/cobra" "github.com/spf13/pflag" "github.com/spf13/viper" + "k8s.io/klog" ) const ( @@ -20,7 +23,17 @@ var flagDefaults = map[string]string{ // Version is populated by make during build. var version string +// panicRecoverAndExitWithStackTrace - recovery from panic, print a failure message and stack trace and exit the program +func panicRecoverAndExitWithStackTrace() { + if r := recover(); r != nil { + klog.Errorf("%+v", r) + klog.Errorf("Stack trace: %s", string(debug.Stack())) + } +} + func main() { + defer panicRecoverAndExitWithStackTrace() + rootCmd := NewRootCmd() if version != "" {