Skip to content

Commit 401ecc8

Browse files
Update azure_pipeline_validation_appmonitoring.yaml for Azure Pipelines
1 parent 61a8585 commit 401ecc8

File tree

1 file changed

+97
-0
lines changed

1 file changed

+97
-0
lines changed

.pipelines/azure_pipeline_validation_appmonitoring.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,100 @@ jobs:
4545
4646
cd $(Build.SourcesDirectory)/deployment/mergebranch-webhook-deployment/ServiceGroupRoot/Scripts
4747
name: setup
48+
49+
- job: build_linux
50+
timeoutInMinutes: 120
51+
dependsOn: common
52+
pool:
53+
name: rambhatt-test-es-pool
54+
variables:
55+
imageTag: $[ dependencies.common.outputs['setup.imageTag'] ]
56+
Codeql.Enabled: true
57+
Codeql.BuildIdentifier: 'linuxbuild'
58+
# This is necessary because of: https://github.com/moby/moby/issues/37965
59+
DOCKER_BUILDKIT: 1
60+
61+
steps:
62+
- task: CodeQL3000Init@0
63+
- task: AzureCLI@2
64+
displayName: "Multi-arch Linux build and Vulnerability Scan"
65+
inputs:
66+
azureSubscription: ${{ variables.armServiceConnectionName }}
67+
scriptType: bash
68+
scriptLocation: inlineScript
69+
inlineScript: |
70+
mkdir -p $(Build.ArtifactStagingDirectory)/linux
71+
72+
echo "Installing NPM..."
73+
sudo apt-get -y install npm
74+
75+
echo "Switching the directory..."
76+
cd appmonitoring/ts/src
77+
pwd
78+
ls -a
79+
80+
echo "Installing npm packages..."
81+
sudo npm install
82+
83+
#echo "Updating packages..."
84+
#npm update
85+
86+
echo "Building the typescript project..."
87+
tsc --build --force
88+
89+
if [ $? -ne 0 ]
90+
then
91+
echo "Build failed"
92+
exit 1
93+
fi
94+
95+
echo "Build is done"
96+
97+
echo "Running ESLint..."
98+
npx eslint .
99+
100+
if [ $? -ne 0 ]
101+
then
102+
echo "ESLint failed"
103+
exit 1
104+
fi
105+
106+
echo "ESLint is done"
107+
108+
echo "Running Jest..."
109+
npm test
110+
111+
if [ $? -ne 0 ]
112+
then
113+
echo "Jest failed"
114+
exit 1
115+
fi
116+
117+
echo "Jest is done"
118+
119+
pwd
120+
ls -a
121+
122+
sudo apt-get update && sudo apt-get -y install qemu binfmt-support qemu-user-static
123+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
124+
125+
docker buildx create --name testbuilder
126+
docker buildx use testbuilder
127+
128+
az --version
129+
az account show
130+
az account set -s ${{ variables.subscription }}
131+
az acr login -n ${{ variables.containerRegistry }}
132+
133+
echo "Build reason = $(Build.Reason)"
134+
135+
if [ "$(Build.Reason)" != "PullRequest" ]; then
136+
docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(imageTag) -f ./Dockerfile --metadata-file $(Build.ArtifactStagingDirectory)/linux/metadata.json --push --provenance=false .
137+
138+
docker pull ${{ variables.repoImageName }}:$(imageTag)
139+
else
140+
docker buildx build --platform linux/amd64,linux/arm64 --tag ${{ variables.repoImageName }}:$(imageTag) -f ./Dockerfile --metadata-file $(Build.ArtifactStagingDirectory)/linux/metadata.json --provenance=false .
141+
142+
# load the multi-arch image to run tests
143+
docker buildx build --tag ${{ variables.repoImageName }}:$(imageTag) -f ./Dockerfile --metadata-file $(Build.ArtifactStagingDirectory)/linux/metadata.json --load --provenance=false .
144+
fi

0 commit comments

Comments
 (0)