added auto adding agent to Wazuh group #46
Workflow file for this run
This file contains 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
name: Build and push docker images for git tag | |
# Controls when the workflow will run | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- dockerfile: ./Dockerfile | |
image: kennyopennix/wazuh-agent | |
- dockerfile: ./images/Dockerfie.amazonlinux | |
image: kennyopennix/wazuh-agent-amazonlinux | |
- dockerfile: ./images/Dockerfie.ubuntu | |
image: kennyopennix/wazuh-agent-ubuntu | |
- dockerfile: ./Dockerfile | |
image: opennix/wazuh-agent | |
- dockerfile: ./images/Dockerfie.amazonlinux | |
image: opennix/wazuh-agent-amazonlinux | |
- dockerfile: ./images/Dockerfie.ubuntu | |
image: opennix/wazuh-agent-ubuntu | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set Agent version | |
shell: bash | |
run: echo "AGENT_VERSION=$(echo ${GITHUB_REF##*/} | sed 's/v//g')" >> $GITHUB_ENV | |
- name: Set Docker tag | |
shell: bash | |
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/} | sed 's/v//g'|sed 's/-1//g')" >> $GITHUB_ENV | |
- name: Docker tag and agent version | |
run: | | |
echo "All envs ${{ env }}" | |
echo "New docker image tag ${{ env.TAG_NAME }}" | |
echo "Wazuh agent version ${{ env.AGENT_VERSION }}" | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
continue-on-error: true | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ matrix.image }}:${{ env.TAG_NAME }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
AGENT_VERSION=${{ env.AGENT_VERSION }} |