forked from wazuh/wazuh-docker
Add registry parameter
This commit is contained in:
@@ -35,9 +35,12 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
registry:
|
registry:
|
||||||
description: 'Docker registry (e.g. ECR URL). Leave empty to use DockerHub. Only applies when version is set.'
|
description: 'Docker registry. ECR for dev versions, DockerHub for prod versions.'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: choice
|
||||||
|
options:
|
||||||
|
- ERC
|
||||||
|
- DockerHub
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
id-token: write
|
id-token: write
|
||||||
@@ -251,17 +254,24 @@ jobs:
|
|||||||
|
|
||||||
- name: Resolve image configuration
|
- name: Resolve image configuration
|
||||||
run: |
|
run: |
|
||||||
# Get from VERSION.json (for pr branch)
|
# Source of truth for cert tool — always from VERSION.json (pr branch)
|
||||||
WAZUH_VERSION="${{ needs.prepare.outputs.wazuh_version }}"
|
WAZUH_VERSION="${{ needs.prepare.outputs.wazuh_version }}"
|
||||||
WAZUH_STAGE="${{ needs.prepare.outputs.wazuh_stage }}"
|
WAZUH_STAGE="${{ needs.prepare.outputs.wazuh_stage }}"
|
||||||
|
|
||||||
|
# Map registry choice to actual URL (defined once)
|
||||||
|
if [ "${{ inputs.registry }}" = "ERC" ]; then
|
||||||
|
SELECTED_REGISTRY="${{ vars.IMAGE_REGISTRY_DEV }}"
|
||||||
|
else
|
||||||
|
SELECTED_REGISTRY="${{ vars.IMAGE_REGISTRY_PROD }}"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "${{ inputs.version }}" ]; then
|
if [ -n "${{ inputs.version }}" ]; then
|
||||||
# Explicit version/revision: use provided registry or fall back to DockerHub prod
|
# Explicit version/revision: use the registry choice mapped above
|
||||||
DOCKER_VERSION="${{ inputs.version }}"
|
DOCKER_VERSION="${{ inputs.version }}"
|
||||||
DOCKER_REVISION="${{ inputs.revision }}"
|
DOCKER_REVISION="${{ inputs.revision }}"
|
||||||
DOCKER_REGISTRY="${{ inputs.registry || vars.IMAGE_REGISTRY_PROD }}"
|
DOCKER_REGISTRY="$SELECTED_REGISTRY"
|
||||||
else
|
else
|
||||||
# Use version from VERSION.json and assume images were built in the previous job and pushed to the dev registry
|
# Build case: always dev registry (build_images job pushed there)
|
||||||
DOCKER_VERSION="${WAZUH_VERSION}"
|
DOCKER_VERSION="${WAZUH_VERSION}"
|
||||||
DOCKER_REVISION="${WAZUH_STAGE}"
|
DOCKER_REVISION="${WAZUH_STAGE}"
|
||||||
DOCKER_REGISTRY="${{ vars.IMAGE_REGISTRY_DEV }}"
|
DOCKER_REGISTRY="${{ vars.IMAGE_REGISTRY_DEV }}"
|
||||||
@@ -347,7 +357,7 @@ jobs:
|
|||||||
"
|
"
|
||||||
|
|
||||||
- name: Login VM to ECR registry
|
- name: Login VM to ECR registry
|
||||||
if: inputs.version == '' || inputs.registry != ''
|
if: inputs.version == '' || inputs.registry == 'ERC'
|
||||||
run: |
|
run: |
|
||||||
ECR_REGISTRY="${{ env.DOCKER_REGISTRY }}"
|
ECR_REGISTRY="${{ env.DOCKER_REGISTRY }}"
|
||||||
ECR_REGION=$(echo "$ECR_REGISTRY" | cut -d. -f4)
|
ECR_REGION=$(echo "$ECR_REGISTRY" | cut -d. -f4)
|
||||||
|
|||||||
Reference in New Issue
Block a user