Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build issues #714

Merged
merged 2 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions .pipelines/azure-pipeline-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,47 @@ jobs:
pathToPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop

- job: Helm_Chart
rashmichandrashekar marked this conversation as resolved.
Show resolved Hide resolved
displayName: "Package 1P helm chart"
pool:
name: Azure-Pipelines-CI-Test-EO
dependsOn:
- Image_Tags_and_Ev2_Artifacts
- Linux_Prometheus_Collector
- WindowsMultiArch_Prometheus_Collector
variables:
HELM_CHART_NAME: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.HELM_CHART_NAME'] ]
HELM_SEMVER: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.SEMVER'] ]
IMAGE_TAG: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.SEMVER'] ]
IMAGE_TAG_WINDOWS: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.WINDOWS_IMAGE_TAG'] ]
HELM_FULL_IMAGE_NAME: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.HELM_FULL_IMAGE_NAME'] ]
steps:
- task: HelmInstaller@1
displayName: 'Build: install Helm version'
inputs:
helmVersionToInstall: 3.12.3

- bash: |
envsubst < $(Build.SourcesDirectory)/otelcollector/deploy/chart/prometheus-collector/Chart-template.yaml > $(Build.SourcesDirectory)/otelcollector/deploy/chart/prometheus-collector/Chart.yaml && envsubst < $(Build.SourcesDirectory)/otelcollector/deploy/chart/prometheus-collector/values-template.yaml > $(Build.SourcesDirectory)/otelcollector/deploy/chart/prometheus-collector/values.yaml
helm version
displayName: "Build: substitute chart version in Chart.yaml and values.yaml"
- bash: |
helm dep update
workingDirectory: $(Build.SourcesDirectory)/otelcollector/deploy/chart/prometheus-collector/
displayName: "Build: update helm dependencies"
- bash: |
helm package ./prometheus-collector/
workingDirectory: $(Build.SourcesDirectory)/otelcollector/deploy/chart/
displayName: "Build: package helm chart"
- bash: |
helm registry login containerinsightsprod.azurecr.io -u $(ACR_USERNAME) -p $(ACR_PASSWORD)
helm push $(HELM_CHART_NAME)-$(HELM_SEMVER).tgz oci://$(ACR_REGISTRY)$(ACR_REPOSITORY_HELM)
mkdir -p $(Build.ArtifactStagingDirectory)/chart
echo {\"image.name\":\"$(HELM_FULL_IMAGE_NAME)\"} > $(Build.ArtifactStagingDirectory)/chart/metadata.json
workingDirectory: $(Build.SourcesDirectory)/otelcollector/deploy/chart/
displayName: "Build: push helm chart to dev ACR"
condition: eq(variables.IS_PR, false)
- job: Arc_Helm_Chart
displayName: "Package: Arc helm chart"
pool:
Expand Down Expand Up @@ -989,6 +1030,7 @@ jobs:
- Image_Tags_and_Ev2_Artifacts
- Linux_Prometheus_Collector
- WindowsMultiArch_Prometheus_Collector
- Helm_Chart
variables:
HELM_CHART_NAME: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.HELM_CHART_NAME'] ]
HELM_SEMVER: $[ dependencies.Image_Tags_and_Ev2_Artifacts.outputs['setup.SEMVER'] ]
Expand Down Expand Up @@ -1018,16 +1060,17 @@ jobs:
echo $(MCR_REGISTRY)$(MCR_REPOSITORY):$(IMAGE_TAG_WINDOWS)
echo $(MCR_REGISTRY)$(MCR_REPOSITORY_HELM):$(IMAGE_TAG)
output=$(curl -s https://$(MCR_REGISTRY)/v2$(MCR_REPOSITORY)/tags/list)
if (echo $output | grep $(IMAGE_TAG_WINDOWS)) && (echo $output | grep $(IMAGE_TAG))
output1=$(curl -s https://$(MCR_REGISTRY)/v2$(MCR_REPOSITORY)/tags/list)
output2=$(curl -s https://$(MCR_REGISTRY)/v2$(MCR_REPOSITORY_HELM)/tags/list)
if (echo $output1 | grep $(IMAGE_TAG_WINDOWS)) && (echo $output2 | grep $(IMAGE_TAG))
then
echo "Images are published to mcr"
echo "Images and chart are published to mcr"
exit 0
fi
done
echo "Images are not published to mcr within the timeout"
echo "Images and chart are not published to mcr within the timeout"
exit 1
displayName: "Check images are pushed to dev MCR"
displayName: "Check images and chart are pushed to dev MCR"
retryCountOnTaskFailure: 5
- bash: |
Expand Down