forked from wazuh/wazuh-docker
Merge pull request #2266 from wazuh/change/3059-modify-artifact-URLs-file-name
Modify artifact URLs file name
This commit is contained in:
@@ -115,7 +115,7 @@ jobs:
|
||||
- name: Log in to Amazon ECR
|
||||
uses: aws-actions/amazon-ecr-login@v2
|
||||
|
||||
- name: Download artifact_urls.yml
|
||||
- name: Download artifact_urls.yaml
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: presigned-artifact-urls-${{ github.run_id }}
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
- name: Add environment variables into GITHUB_ENV
|
||||
run: |
|
||||
# Export variables to the environment
|
||||
awk -F':' '!/^#/ && NF>1 {name=$1; val=substr($0,length(name)+3); gsub(/[-.]/,"_",name); print name "=" val}' artifact_urls.yml >> "$GITHUB_ENV"
|
||||
awk -F':' '!/^#/ && NF>1 {name=$1; val=substr($0,length(name)+3); gsub(/[-.]/,"_",name); print name "=" val}' ${{ env.ARTIFACT_URL_FILE_NAME }} >> "$GITHUB_ENV"
|
||||
working-directory: ./single-node/
|
||||
|
||||
- name: Create single node certficates
|
||||
@@ -388,7 +388,7 @@ jobs:
|
||||
- name: Log in to Amazon ECR
|
||||
uses: aws-actions/amazon-ecr-login@v2
|
||||
|
||||
- name: Download artifact_urls.yml
|
||||
- name: Download artifact_urls.yaml
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: presigned-artifact-urls-${{ github.run_id }}
|
||||
@@ -397,7 +397,7 @@ jobs:
|
||||
- name: Add environment variables into GITHUB_ENV
|
||||
run: |
|
||||
# Export variables to the environment
|
||||
awk -F':' '!/^#/ && NF>1 {name=$1; val=substr($0,length(name)+3); gsub(/[-.]/,"_",name); print name "=" val}' artifact_urls.yml >> "$GITHUB_ENV"
|
||||
awk -F':' '!/^#/ && NF>1 {name=$1; val=substr($0,length(name)+3); gsub(/[-.]/,"_",name); print name "=" val}' ${{ env.ARTIFACT_URL_FILE_NAME }} >> "$GITHUB_ENV"
|
||||
working-directory: ./multi-node/
|
||||
|
||||
- name: Create multi node certficates
|
||||
|
||||
@@ -165,7 +165,7 @@ jobs:
|
||||
WORKFLOW_VENV: "${{ github.workspace }}/workflow_venv"
|
||||
GENERATE_PRESIGNED_URLS_SCRIPT_PATH: ${{ github.workspace }}/wazuh-automation/tools/sign_urls/generate_presigned_dev_urls.py
|
||||
PRESIGNED_URLS_SCRIPT_PROCESS: "build_docker"
|
||||
LOCAL_ARTIFACT_URLS_FILEPATH: /tmp/artifact_urls.yml
|
||||
LOCAL_ARTIFACT_URLS_FILEPATH: /tmp/${{ vars.ARTIFACT_URL_FILE_NAME }}
|
||||
COMMIT_LIST: ${{ inputs.commit_list }}
|
||||
ASSISTANT_REVISION: ${{ inputs.assistant_revision }}
|
||||
|
||||
@@ -330,7 +330,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
|
||||
- name: Download artifact_urls.yml (dev)
|
||||
- name: Download artifact_urls.yaml (dev)
|
||||
if: ${{ inputs.dev == true }}
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
*.log
|
||||
build-docker-images/artifact_urls.yml
|
||||
build-docker-images/artifact_urls.yaml
|
||||
build-docker-images/artifacts_env.txt
|
||||
single-node/wazuh-certificates
|
||||
single-node/wazuh-certificates/*
|
||||
|
||||
@@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Changed
|
||||
|
||||
- Modify artifact URLs file name. ([#2266](https://github.com/wazuh/wazuh-docker/pull/2266))
|
||||
- Use URL signing script to generate presigned internal package URLs. ([#2259](https://github.com/wazuh/wazuh-docker/pull/2259))
|
||||
- Updated wazuh-docker documentation config and tooling versions to meet new standards. ([#2264](https://github.com/wazuh/wazuh-docker/pull/2264))
|
||||
- Update certificate configuration to use separate IP and DNS fields ([#2253](https://github.com/wazuh/wazuh-docker/pull/2253))
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
WAZUH_IMAGE_VERSION=5.0.0
|
||||
IMAGE_TAG=5.0.0
|
||||
WAZUH_VERSION=$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g')
|
||||
WAZUH_CURRENT_VERSION=$(curl --silent https://api.github.com/repos/wazuh/wazuh/releases/latest | grep '["]tag_name["]:' | sed -E 's/.*\"([^\"]+)\".*/\1/' | cut -c 2- | sed -e 's/\.//g')
|
||||
IMAGE_VERSION=${WAZUH_IMAGE_VERSION}
|
||||
WAZUH_REGISTRY=docker.io
|
||||
@@ -38,24 +37,42 @@ ctrl_c() {
|
||||
|
||||
build() {
|
||||
|
||||
WAZUH_VERSION="$(echo $WAZUH_IMAGE_VERSION | sed -e 's/\.//g')"
|
||||
# WAZUH_MINOR_VERSION: Extracts major and minor version only (e.g., 5.0.0 -> 5.0)
|
||||
WAZUH_MINOR_VERSION="${WAZUH_IMAGE_VERSION%.*}"
|
||||
# WAZUH_MAJOR_VERSION: Extracts major version only (e.g., 5.0.0 -> 5)
|
||||
WAZUH_MAJOR_VERSION="${WAZUH_IMAGE_VERSION%%.*}"
|
||||
# WAZUH_STAGE: Extract the 'stage' (e.g., alpha0, beta1, rc2) from the local JSON metadata file.
|
||||
# Note: This is primarily used for pre-release package naming.
|
||||
WAZUH_STAGE=$(jq -r '.stage' ../VERSION.json)
|
||||
# ARTIFACT_URLS_FILE: The name of the artifact URLs file.
|
||||
ARTIFACT_URLS_FILE="artifact_urls.yaml"
|
||||
|
||||
# Variables
|
||||
ARTIFACT_URLS_FILE="artifact_urls.yml"
|
||||
|
||||
# Check if the artifact file already exists to prevent redundant downloads
|
||||
if [[ -f "$ARTIFACT_URLS_FILE" ]]; then
|
||||
echo "$ARTIFACT_URLS_FILE exists. Using existing file."
|
||||
else
|
||||
TAG="v${WAZUH_VERSION}"
|
||||
# Prepare logic to fetch the artifact from Wazuh's infrastructure
|
||||
TAG="v${WAZUH_IMAGE_VERSION}"
|
||||
REPO="wazuh/wazuh-docker"
|
||||
GH_URL="https://api.github.com/repos/${REPO}/git/refs/tags/${TAG}"
|
||||
|
||||
# Use GitHub API to check if the tag exists publicly.
|
||||
# This determines if we should look for production or staging artifacts.
|
||||
if curl -fsSL "$GH_URL" >/dev/null 2>&1; then
|
||||
curl -fsSL -o "$ARTIFACT_URLS_FILE" "https://packages.wazuh.com/${WAZUH_MINOR_VERSION}/${ARTIFACT_URLS_FILE}"
|
||||
# CASE: Production (Tag exists in the official repository)
|
||||
ARTIFACT_URLS_DOWNLOAD=artifact_urls_${WAZUH_IMAGE_VERSION}.yaml
|
||||
PACKAGE_URL=packages.wazuh.com
|
||||
RELEASE_STAGE=production
|
||||
else
|
||||
curl -fsSL -o "$ARTIFACT_URLS_FILE" "https://packages-dev.wazuh.com/${WAZUH_MINOR_VERSION}/${ARTIFACT_URLS_FILE}"
|
||||
# CASE: Pre-release/Staging (Tag not found, fall back to staging environment)
|
||||
# Includes the WAZUH_STAGE suffix (e.g., artifact_urls_5.0.0-alpha0.yaml)
|
||||
ARTIFACT_URLS_DOWNLOAD=artifact_urls_${WAZUH_IMAGE_VERSION}-${WAZUH_STAGE}.yaml
|
||||
PACKAGE_URL=packages-staging.xdrsiem.wazuh.info
|
||||
RELEASE_STAGE=pre-release
|
||||
fi
|
||||
# Final download using dynamic variables based on the release type.
|
||||
# Pattern: server / stage / major_version.x / filename
|
||||
curl -fsSL -o "$ARTIFACT_URLS_FILE" "https://${PACKAGE_URL}/${RELEASE_STAGE}/${WAZUH_MAJOR_VERSION}.x/${ARTIFACT_URLS_DOWNLOAD}"
|
||||
fi
|
||||
|
||||
awk -F':' '!/^#/ && NF>1 {name=$1; val=substr($0,length(name)+3); gsub(/[-.]/,"_",name); print name "=\"" val "\""}' $ARTIFACT_URLS_FILE > artifacts_env.txt
|
||||
|
||||
@@ -18,7 +18,7 @@ The Procedure_push_docker_images.yml workflow builds and pushes multi-architectu
|
||||
|
||||
- Pushes to AWS ECR (Elastic Container Registry)
|
||||
- Uses pre-signed S3 URLs for packages
|
||||
- Generates dynamic `artifact_urls.yml` from S3 bucket
|
||||
- Generates dynamic `artifact_urls.yaml` from S3 bucket
|
||||
- Adds development reference to image tags
|
||||
- Authenticates via AWS IAM role
|
||||
|
||||
|
||||
Reference in New Issue
Block a user