Skip to content

feat(cli): Allow users to specify key type and size for key generatio… #3590

feat(cli): Allow users to specify key type and size for key generatio…

feat(cli): Allow users to specify key type and size for key generatio… #3590

Workflow file for this run

name: Build & publish images
on:
push:
branches:
- main
pull_request:
branches:
- main
types: [ labeled, unlabeled, opened, synchronize, reopened ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-vars:
name: Gather job information
if: github.repository == 'argoproj-labs/argocd-agent'
runs-on: ubuntu-22.04
outputs:
image-tag: ${{ steps.image.outputs.tag }}
latest: ${{ steps.image.outputs.latest }}
steps:
- name: Checkout source code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set image tag for pushing to ghcr
run: |
if test "${{ github.event_name }}" = "pull_request"; then
echo "tag=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
else
echo "tag=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
echo "latest=yes" >> $GITHUB_OUTPUT
fi
id: image
build-and-push:
name: Build and push image
permissions:
contents: read
packages: write
runs-on: ubuntu-22.04
if: github.repository == 'argoproj-labs/argocd-agent'
needs: [set-vars]
env:
DOCKER_BIN: podman
IMAGE_TAG: ${{ needs.set-vars.outputs.image-tag }}
IMAGE_LATEST: ${{ needs.set-vars.outputs.latest }}
IMAGE_REPOSITORY: ghcr.io/argoproj-labs/argocd-agent
IMAGE_NAME: ghcr.io/argoproj-labs/argocd-agent/argocd-agent
steps:
- name: Checkout source code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Build argocd-agent container image
run: |
if [[ "$GITHUB_REPOSITORY" == "argoproj-labs/argocd-agent" ]] && ( [[ "$GITHUB_EVENT_NAME" == "push" ]] || jq -e '.pull_request.labels[].name == "ok-to-push"' "$GITHUB_EVENT_PATH" > /dev/null ); then
make image-multiarch
else
make image
fi
- name: Tag latest
if: env.IMAGE_LATEST == 'yes'
run: |
${DOCKER_BIN} tag ${IMAGE_NAME}:${IMAGE_TAG} ${IMAGE_NAME}:latest
- name: Push agent image to ghcr.io
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8
if: github.repository == 'argoproj-labs/argocd-agent' && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ok-to-push') )
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.IMAGE_TAG }}
- name: Push latest tag to ghcr.io
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8
if: github.repository == 'argoproj-labs/argocd-agent' && ( github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'ok-to-push') && env.IMAGE_LATEST == 'yes' )
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
image: ${{ env.IMAGE_NAME }}
tags: latest