Replaced parameters by env variables
This commit is contained in:
@ -4,18 +4,6 @@ metadata:
|
||||
generateName: build-workflow-
|
||||
spec:
|
||||
entrypoint: main
|
||||
arguments:
|
||||
parameters:
|
||||
- name: repo
|
||||
value: https://gitea.marcin00.pl/pikram/user-microservice.git
|
||||
- name: branch
|
||||
value: dev
|
||||
- name: image
|
||||
value: marcin00.azurecr.io/user-microservice
|
||||
- name: acr-name
|
||||
value: marcin00
|
||||
- name: client-id # client-id of the user-assigned managed identity used by cluster
|
||||
value: c302726f-fafb-4143-94c1-67a70975574a
|
||||
serviceAccountName: argo-workflows-user
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
@ -32,12 +20,6 @@ spec:
|
||||
steps:
|
||||
- - name: checkout
|
||||
template: checkout
|
||||
arguments:
|
||||
parameters:
|
||||
- name: repo
|
||||
value: "{{workflow.parameters.repo}}"
|
||||
- name: branch
|
||||
value: "{{workflow.parameters.branch}}"
|
||||
- - name: tests
|
||||
template: tests
|
||||
- - name: build-and-push-image
|
||||
@ -49,17 +31,18 @@ spec:
|
||||
|
||||
# GIT CHECKOUT
|
||||
- name: checkout
|
||||
inputs:
|
||||
parameters:
|
||||
- name: repo
|
||||
- name: branch
|
||||
container:
|
||||
image: alpine/git
|
||||
command: [sh,-c]
|
||||
workingDir: /workspace
|
||||
env:
|
||||
- name: REPO_URL
|
||||
value: https://gitea.marcin00.pl/pikram/user-microservice.git
|
||||
- name: REPO_BRANCH
|
||||
value: dev
|
||||
args:
|
||||
- |
|
||||
git clone --depth 1 --branch "{{inputs.parameters.branch}}" --single-branch "{{inputs.parameters.repo}}" repo
|
||||
git clone --depth 1 --branch "${REPO_BRANCH}" --single-branch "${REPO_URL}" repo
|
||||
cd repo
|
||||
git rev-parse HEAD > /tmp/gitsha.txt
|
||||
volumeMounts:
|
||||
@ -100,15 +83,20 @@ spec:
|
||||
image: marcin00.azurecr.io/azure-cli-docker:slim-bookworm
|
||||
command: [sh, -c]
|
||||
workingDir: /workspace/repo
|
||||
env:
|
||||
- name: DOCKER_IMAGE
|
||||
value: marcin00.azurecr.io/user-microservice:{{inputs.parameters.git-sha}}
|
||||
- name: CLIENT_ID
|
||||
value: c302726f-fafb-4143-94c1-67a70975574a # Client id tożsamości zarządzanej używanej przez klaster
|
||||
- name: ACR_NAME
|
||||
value: marcin00
|
||||
args:
|
||||
- |
|
||||
dockerd &
|
||||
CI_COMMIT_SHA={{inputs.parameters.git-sha}}
|
||||
DOCKER_IMAGE={{workflow.parameters.image}}:${CI_COMMIT_SHA}
|
||||
docker build -t $DOCKER_IMAGE --build-arg APP_VERSION=${CI_COMMIT_SHA} --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") .
|
||||
docker build -t $DOCKER_IMAGE --build-arg APP_VERSION={{inputs.parameters.git-sha}} --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") .
|
||||
|
||||
az login --identity --client-id {{workflow.parameters.client-id}}
|
||||
az acr login --name {{workflow.parameters.acr-name}}
|
||||
az login --identity --client-id ${CLIENT_ID}
|
||||
az acr login --name ${ACR_NAME}
|
||||
docker push ${DOCKER_IMAGE}
|
||||
volumeMounts:
|
||||
- name: workspace
|
||||
|
Reference in New Issue
Block a user