Skip to content

Commit d40b293

Browse files
authored
NPM build with CGO enabled and temporarily disable swift e2e (#1275)
* pull stack trace on crash * enable cgo * remove swift pipeline temporarily * remove cleanup dependency
1 parent cc78c9d commit d40b293

File tree

3 files changed

+91
-80
lines changed

3 files changed

+91
-80
lines changed

.pipelines/pipeline.yaml

Lines changed: 76 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
pr:
22
branches:
33
include:
4-
- master
5-
- honeycomb-dev
4+
- master
5+
- honeycomb-dev
66

77
trigger:
88
branches:
99
include:
10-
- master
11-
- honeycomb-dev
10+
- master
11+
- honeycomb-dev
1212

1313
stages:
1414
- stage: setup
1515
displayName: ACN
1616
jobs:
1717
- job: env
18-
displayName: Setup
18+
displayName: Setup
1919
pool:
2020
name: "$(BUILD_POOL_NAME_DEFAULT)"
2121
steps:
@@ -35,7 +35,7 @@ stages:
3535
- stage: build_and_test
3636
displayName: Build ACN and Test
3737
dependsOn:
38-
- setup
38+
- setup
3939
jobs:
4040
- job: build
4141
displayName: Build Binaries
@@ -133,84 +133,82 @@ stages:
133133
- stage: containerize
134134
displayName: Build Images
135135
dependsOn:
136-
- setup
137-
- build_and_test
136+
- setup
137+
- build_and_test
138138
jobs:
139-
- job: containerize
140-
displayName: Build Images
141-
variables:
142-
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
143-
pool:
144-
name: "$(BUILD_POOL_NAME_DEFAULT)"
145-
strategy:
146-
matrix:
147-
cni_manager_linux_amd64:
148-
arch: amd64
149-
os: linux
150-
name: cni-manager
151-
cni_manager_linux_arm64:
152-
arch: arm64
153-
os: linux
154-
name: cni-manager
155-
cns_linux_amd64:
156-
arch: amd64
157-
os: linux
158-
name: cns
159-
cns_linux_arm64:
160-
arch: arm64
161-
os: linux
162-
name: cns
163-
npm_linux_amd64:
164-
arch: amd64
165-
os: linux
166-
name: npm
167-
npm_linux_arm64:
168-
arch: arm64
169-
os: linux
170-
name: npm
171-
steps:
172-
- template: containers/container-template.yaml
173-
parameters:
174-
name: $(name)
175-
os: $(os)
176-
arch: $(arch)
177-
tag: $(TAG)
139+
- job: containerize
140+
displayName: Build Images
141+
variables:
142+
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
143+
pool:
144+
name: "$(BUILD_POOL_NAME_DEFAULT)"
145+
strategy:
146+
matrix:
147+
cni_manager_linux_amd64:
148+
arch: amd64
149+
os: linux
150+
name: cni-manager
151+
cni_manager_linux_arm64:
152+
arch: arm64
153+
os: linux
154+
name: cni-manager
155+
cns_linux_amd64:
156+
arch: amd64
157+
os: linux
158+
name: cns
159+
cns_linux_arm64:
160+
arch: arm64
161+
os: linux
162+
name: cns
163+
npm_linux_amd64:
164+
arch: amd64
165+
os: linux
166+
name: npm
167+
npm_linux_arm64:
168+
arch: arm64
169+
os: linux
170+
name: npm
171+
steps:
172+
- template: containers/container-template.yaml
173+
parameters:
174+
name: $(name)
175+
os: $(os)
176+
arch: $(arch)
177+
tag: $(TAG)
178178

179179
- stage: publish
180180
displayName: Publish Multiarch Manifests
181181
dependsOn:
182-
- setup
183-
- containerize
182+
- setup
183+
- containerize
184184
jobs:
185-
- job: manifest
186-
displayName: Compile Manifests
187-
variables:
188-
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
189-
pool:
190-
name: "$(BUILD_POOL_NAME_DEFAULT)"
191-
strategy:
192-
matrix:
193-
cni-manager:
194-
name: cni-manager
195-
cns:
196-
name: cns
197-
npm:
198-
name: npm
199-
steps:
200-
- template: containers/manifest-template.yaml
201-
parameters:
202-
name: $(name)
203-
oses: linux
204-
arches: amd64 arm64
205-
tag: $(TAG)
206-
207-
208-
- template: singletenancy/aks-swift/e2e-job-template.yaml
209-
parameters:
210-
name: "aks_swift_e2e"
211-
displayName: AKS Swift
212-
pipelineBuildImage: "$(BUILD_IMAGE)"
185+
- job: manifest
186+
displayName: Compile Manifests
187+
variables:
188+
TAG: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.Tag'] ]
189+
pool:
190+
name: "$(BUILD_POOL_NAME_DEFAULT)"
191+
strategy:
192+
matrix:
193+
cni-manager:
194+
name: cni-manager
195+
cns:
196+
name: cns
197+
npm:
198+
name: npm
199+
steps:
200+
- template: containers/manifest-template.yaml
201+
parameters:
202+
name: $(name)
203+
oses: linux
204+
arches: amd64 arm64
205+
tag: $(TAG)
213206

207+
# - template: singletenancy/aks-swift/e2e-job-template.yaml
208+
# parameters:
209+
# name: "aks_swift_e2e"
210+
# displayName: AKS Swift
211+
# pipelineBuildImage: "$(BUILD_IMAGE)"
214212

215213
- template: singletenancy/aks-engine/e2e-job-template.yaml
216214
parameters:
@@ -265,7 +263,7 @@ stages:
265263
- stage: cleanup
266264
displayName: Cleanup
267265
dependsOn:
268-
- "aks_swift_e2e"
266+
# - "aks_swift_e2e"
269267
- "ubuntu_18_04_linux_e2e"
270268
- "windows_19_03_e2e"
271269
- "windows_20_04_e2e"

npm/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ WORKDIR /usr/local/src/npm
1111
COPY . .
1212

1313
# Build npm
14-
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
14+
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
1515

1616
# Use a minimal image as a final image base
1717
FROM docker.io/ubuntu:focal
1818

1919
# Copy into final image
2020
COPY --from=builder /usr/local/bin/azure-npm \
21-
/usr/bin/azure-npm
21+
/usr/bin/azure-npm
2222

2323
COPY --from=builder /usr/local/src/npm/npm/scripts \
2424
/usr/local/npm

npm/cmd/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
package main
44

55
import (
6+
"runtime/debug"
7+
68
"github.com/spf13/cobra"
79
"github.com/spf13/pflag"
810
"github.com/spf13/viper"
11+
"k8s.io/klog"
912
)
1013

1114
const (
@@ -20,7 +23,17 @@ var flagDefaults = map[string]string{
2023
// Version is populated by make during build.
2124
var version string
2225

26+
// panicRecoverAndExitWithStackTrace - recovery from panic, print a failure message and stack trace and exit the program
27+
func panicRecoverAndExitWithStackTrace() {
28+
if r := recover(); r != nil {
29+
klog.Errorf("%+v", r)
30+
klog.Errorf("Stack trace: %s", string(debug.Stack()))
31+
}
32+
}
33+
2334
func main() {
35+
defer panicRecoverAndExitWithStackTrace()
36+
2437
rootCmd := NewRootCmd()
2538

2639
if version != "" {

0 commit comments

Comments
 (0)