Skip to content

Commit

Permalink
Makefile modified
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhadapaithankar committed Aug 27, 2024
1 parent 3932312 commit da2acf0
Showing 1 changed file with 72 additions and 45 deletions.
117 changes: 72 additions & 45 deletions .pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,50 +121,6 @@ stages:
make lint-admin-portal
displayName: 🧹 Lint Admin Portal
- job: Pull_And_Push_Image_To_ACR
pool:
vmImage: 'ubuntu-latest'
variables:
ob_outputDirectory: '$(Build.SourcesDirectory)/out'
IMAGE_TAG: $(Build.SourceBranchName)
REPOSITORY: 'my-image-repo'
ACR_FQDN: 'arosvcdev.azurecr.io' # ACR FQDN
steps:
- checkout: self

# Authenticate with Azure using the Managed Identity service connection
- task: AzureCLI@2
inputs:
azureSubscription: 'ado-pipeline-dev-image-push' # Service connection name
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az acr login --name ${ACR_FQDN%%.*}
docker login ${ACR_FQDN} -u "00000000-0000-0000-0000-000000000000" -p "$(az acr login --name ${ACR_FQDN%%.*} --expose-token --output tsv --query accessToken)"
mkdir -p "${ob_outputDirectory}"
docker pull ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} || echo "Image not found."
if [ -f "${ob_outputDirectory}/image.tar" ]; then
docker save ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} -o ${ob_outputDirectory}/image.tar
fi
displayName: 'Pulling Docker Image using Docker'

# Push the Docker image to ACR
- task: AzureCLI@2
inputs:
azureSubscription: 'ado-pipeline-dev-image-push' # Service connection name
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
if [ -f "${ob_outputDirectory}/image.tar" ]; then
docker load -i ${ob_outputDirectory}/image.tar
docker tag ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} ${ACR_FQDN}/${REPOSITORY}:latest
docker push ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG}
docker push ${ACR_FQDN}/${REPOSITORY}:latest
else
echo "Image tar file not found, skipping push."
fi
displayName: 'Pushing Docker Image to ACR'

- stage: Containerized
dependsOn: []
jobs:
Expand Down Expand Up @@ -239,7 +195,51 @@ stages:
make test-python
[[ -z "$(git status -s)" ]]
target: python
- job: Pull_And_Push_Image_To_ACR
pool:
vmImage: 'ubuntu-latest'
variables:
ob_outputDirectory: '$(Build.SourcesDirectory)/out'
IMAGE_TAG: $(Build.SourceBranchName)
REPOSITORY: 'my-image-repo'
ACR_FQDN: 'arosvcdev.azurecr.io' # ACR FQDN
steps:
- checkout: self

# Authenticate with Azure using the Managed Identity service connection
- task: AzureCLI@2
inputs:
azureSubscription: 'ado-pipeline-dev-image-push' # Service connection name
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az acr login --name ${ACR_FQDN%%.*}
docker login ${ACR_FQDN} -u "00000000-0000-0000-0000-000000000000" -p "$(az acr login --name ${ACR_FQDN%%.*} --expose-token --output tsv --query accessToken)"
mkdir -p "${ob_outputDirectory}"
docker pull ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} || echo "Image not found."
if [ -f "${ob_outputDirectory}/image.tar" ]; then
docker save ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} -o ${ob_outputDirectory}/image.tar
fi
displayName: 'Pulling Docker Image using Docker'

# Push the Docker image to ACR
- task: AzureCLI@2
inputs:
azureSubscription: 'ado-pipeline-dev-image-push' # Service connection name
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
if [ -f "${ob_outputDirectory}/image.tar" ]; then
docker load -i ${ob_outputDirectory}/image.tar
docker tag ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG} ${ACR_FQDN}/${REPOSITORY}:latest
docker push ${ACR_FQDN}/${REPOSITORY}:${IMAGE_TAG}
docker push ${ACR_FQDN}/${REPOSITORY}:latest
else
echo "Image tar file not found, skipping push."
fi
displayName: 'Pushing Docker Image to ACR'

- job: Extract_Coverage_Report
pool:
vmImage: 'ubuntu-latest'
Expand Down Expand Up @@ -280,3 +280,30 @@ stages:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/cover.out
displayName: 'Publish Code Coverage Results'

- job: Golang_Unit_Tests_Containerized
pool:
name: 1es-aro-ci-pool
steps:
- template: ./templates/template-checkout.yml

- script: |
set -xe
# Install podman for containerized testing
sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y podman
# Ensure podman is available in the current shell session
export PATH=$PATH:/usr/bin:/usr/local/bin
which podman
podman --version
# run build
export PODMAN_REMOTE_ARGS="-r --url=tcp://localhost:8888"
# Stop podman
kill_podman
# Run unit tests
make unit-test-go
target: ubi8

0 comments on commit da2acf0

Please sign in to comment.