Packages - Upload docker images pkg_deb_agent_builder_amd64 #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
run-name: Packages - Upload docker images pkg_${{ inputs.system }}_agent_builder_${{ inputs.architecture }} | |
name: Upload agent amd docker images | |
on: | |
workflow_dispatch: | |
inputs: | |
docker_image_tag: | |
description: | | |
Tag name of the Docker image to be uploaded. | |
Use 'developer' to set branch name as tag. | |
Use 'auto' to set branch version as tag. | |
If using a custom tag, use only '-', '_', '.' and alphanumeric characters. | |
Default is 'auto'. | |
required: false | |
default: auto | |
system: | |
type: choice | |
description: | | |
System image to upload [deb, rpm]. | |
required: true | |
options: | |
- deb | |
- rpm | |
architecture: | |
type: choice | |
description: Architecture of the docker image builder. | |
required: true | |
options: | |
- amd64 | |
- arm64 | |
- x86_64 | |
- aarch64 | |
source_reference: | |
description: | | |
Branch from wazuh/wazuh-agent repository to use. | |
required: true | |
jobs: | |
Upload-package-building-images: | |
runs-on: ${{ (inputs.architecture == 'arm64' || inputs.architecture == 'aarch64') && 'wz-linux-arm64' || 'ubuntu-24.04' }} | |
name: Package - Upload pkg_${{ inputs.system }}_agent_builder_${{ inputs.architecture }} with tag ${{ inputs.docker_image_tag }} | |
timeout-minutes: 240 | |
steps: | |
- name: Checkout wazuh/wazuh-agent repository | |
uses: actions/checkout@v4 | |
with: | |
repository: wazuh/wazuh-agent | |
ref: ${{ inputs.source_reference }} | |
- name: Set ARCH | |
run: | | |
if [ ${{ inputs.architecture }} = 'x86_64' ]; then | |
arch="amd64" | |
elif [ ${{ inputs.architecture }} = 'aarch64' ]; then | |
arch="arm64" | |
else | |
arch=${{ inputs.architecture }} | |
fi | |
echo "ARCH=$arch" >> $GITHUB_ENV; | |
- name: Set TAG | |
run: | | |
VERSION=$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' ./VERSION.json) | |
if [ "${{ inputs.docker_image_tag }}" == "auto" ]; then | |
echo "TAG=$VERSION" >> $GITHUB_ENV; | |
elif [ "${{ inputs.docker_image_tag }}" == "developer" ]; then | |
echo "TAG=$(sed 's|[/\]|--|g' <<< ${{ inputs.source_reference }})" >> $GITHUB_ENV; | |
else | |
echo "TAG=${{ inputs.docker_image_tag }}" >> $GITHUB_ENV; | |
fi | |
- name: Set CONTAINER_NAME and DOCKERFILE_PATH | |
run: | | |
echo "CONTAINER_NAME=pkg_${{ inputs.system }}_agent_builder_${{ env.ARCH }}" >> $GITHUB_ENV | |
echo "DOCKERFILE_PATH=packages/${{ inputs.system }}s/${{ env.ARCH}}/agent" >> $GITHUB_ENV | |
- name: Build and push image ${{ env.CONTAINER_NAME }} with tag ${{ env.TAG }} to Github Container Registry | |
run: | |
bash ./.github/actions/6_builderpackage_docker_images/build_and_push_image_to_ghcr.sh ${{ secrets.CI_WAZUH_AGENT_PACKAGES_CLASSIC }} ${{ github.actor}} ${{ env.CONTAINER_NAME }} ${{ env.DOCKERFILE_PATH }} ${{ env.TAG }} |