Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/super-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
fi

- name: Lint Code Base
uses: super-linter/super-linter@9e863354e3ff62e0727d37183162c4a88873df41 #v8.6.0
uses: super-linter/super-linter/slim@9e863354e3ff62e0727d37183162c4a88873df41 # v8.6.0
env:
VALIDATE_ALL_CODEBASE: ${{ inputs.full_scan || false }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion workflow-templates/apm-packages-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
persist-credentials: false

- name: Run apm-packages-update action
uses: netcracker/qubership-workflow-hub/actions/apm-packages-update@v2.3.1
uses: netcracker/qubership-workflow-hub/actions/apm-packages-update@v2.4.0
with:
branch: ${{ env.BRANCH }}
debug: ${{ env.DEBUG }}
Expand Down
136 changes: 84 additions & 52 deletions workflow-templates/dev-docker-build-multiple-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,100 +27,132 @@ on:
description: "Symbol to replace in tags"
push:
branches:
- '**'
- '**'
paths-ignore:
- '.github/**'
- 'docs/**'
- 'CODE-OF-CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- 'SECURITY.md'
- '.github/**'
- 'docs/**'
- 'CODE-OF-CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- 'SECURITY.md'
pull_request:
branches:
- '**'
- '**'
paths-ignore:
- '.github/**'
- 'docs/**'
- 'CODE-OF-CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- 'SECURITY.md'
- '.github/**'
- 'docs/**'
- 'CODE-OF-CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
- 'README.md'
- 'SECURITY.md'
permissions:
contents: read

concurrency:
group: ${{ github.workflow_ref }}-${{ github.event_name }}-${{ github.ref_type == 'branch' && github.ref_name || github.sha }}
cancel-in-progress: false

env:
CONFIG_FILE: '.qubership/docker.cfg'
DRY_RUN: >-
${{
inputs.dry-run ||
github.event.sender.type == 'Bot' ||
github.triggering_actor != github.actor ||
(github.event_name == 'pull_request' &&
(github.event.pull_request.head.repo.full_name != github.repository ||
github.event.pull_request.user.type == 'Bot'))
}}

jobs:
load-config:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
packages: read
contents: read
outputs:
dry-run: ${{ steps.policy.outputs.dry-run }}
packages: ${{ steps.config.outputs.config }}
tags: ${{ steps.metadata.outputs.result }}
steps:
- name: "Export publish policy"
id: policy
env:
VALUE: ${{ env.DRY_RUN }}
run: printf 'dry-run=%s\n' "$VALUE" >> "$GITHUB_OUTPUT"

- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: Get Configuration File
uses: netcracker/qubership-workflow-hub/actions/docker-config-resolver@cabbb90e9471163cfac84bd50ff0296b2803b44c #v2.3.0
uses: netcracker/qubership-workflow-hub/actions/docker-config-resolver@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
id: config
with:
file-path: "${{ env.CONFIG_FILE }}"

- name: "Create name"
uses: netcracker/qubership-workflow-hub/actions/metadata-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
id: metadata
with:
default-template: "{{ref-name}}"
extra-tags: ${{ inputs.tags || '' }}
replace-symbol: ${{ inputs.replace-symbol || '_' }}

- name: "Summary step"
env:
METADATA: ${{ steps.metadata.outputs.result }}
TAGS: ${{ steps.metadata.outputs.result }}
run: |
printf '**Metadata:** %s\n' "$METADATA" >> "$GITHUB_STEP_SUMMARY"
printf '**Tags:** %s\n' "$TAGS" >> "$GITHUB_STEP_SUMMARY"

docker-build:
name: "Build and Publish Docker Image"
name: "Docker Image Dry Run"
if: needs.load-config.outputs.dry-run == 'true'
needs: load-config
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
component: ${{ fromJson(needs.load-config.outputs.packages) }}
steps:
- name: "Checkout code"
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false

- name: "Create name"
uses: netcracker/qubership-workflow-hub/actions/metadata-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
id: metadata
- name: "Build Docker Image"
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
with:
default-template: "{{ref-name}}"
extra-tags: ${{ github.event.inputs.tags || '' }}
replace-symbol: ${{ github.event.inputs.replace-symbol || '_'}}

- name: "Prepare tags"
id: prepare_tags
run: |
BASE_TAG="${{ steps.metadata.outputs.result }}"
EXTRA_TAG="${{ github.event.inputs.tags }}"
if [ -n "$EXTRA_TAG" ]; then
TAGS="${BASE_TAG}, ${EXTRA_TAG}"
else
TAGS="${BASE_TAG}"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT

- name: "Summary step"
run: |
echo "**Metadata:** ${{ steps.metadata.outputs.result }}" >> $GITHUB_STEP_SUMMARY
echo "**Tags:** ${{ steps.prepare_tags.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
component: ${{ toJson(matrix.component) }}
platforms: ${{ matrix.component.platforms }}
tags: ${{ needs.load-config.outputs.tags }}
dry-run: "true"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker-publish:
name: "Docker Image Publish"
if: needs.load-config.outputs.dry-run == 'false' && github.triggering_actor == github.actor
needs: load-config
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
component: ${{ fromJson(needs.load-config.outputs.packages) }}
steps:
- name: "Build and Publish Docker Image"
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c #v2.3.0
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
with:
component: ${{ toJson(matrix.component) }}
platforms: ${{ matrix.component.platforms }}
checkout: "false"
tags: ${{ steps.prepare_tags.outputs.tags }}
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
tags: ${{ needs.load-config.outputs.tags }}
dry-run: "false"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91 changes: 67 additions & 24 deletions workflow-templates/dev-docker-build-selective.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,40 @@ permissions:
contents: read

concurrency:
group: ${{ github.ref_type == 'branch' && format('build-branch-{0}', github.ref_name) || format('build-{0}', github.sha) }}
cancel-in-progress: true
group: ${{ github.workflow_ref }}-${{ github.event_name }}-${{ github.ref_type == 'branch' && github.ref_name || github.sha }}
cancel-in-progress: false

env:
CONFIG_FILE: '.qubership/docker.cfg'
DRY_RUN: >-
${{
inputs.dry-run ||
github.event.sender.type == 'Bot' ||
github.triggering_actor != github.actor ||
(github.event_name == 'pull_request' &&
(github.event.pull_request.head.repo.full_name != github.repository ||
github.event.pull_request.user.type == 'Bot'))
}}

jobs:
prepare:
name: "Prepare Images and Metadata"
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
dry-run: ${{ steps.policy.outputs.dry-run }}
packages: ${{ steps.config.outputs.config }}
tags: "${{ steps.meta.outputs.result }}"
steps:
- name: "Export publish policy"
id: policy
env:
VALUE: ${{ env.DRY_RUN }}
run: printf 'dry-run=%s\n' "$VALUE" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: true
persist-credentials: false
fetch-depth: 0

- name: Changed Files
Expand All @@ -81,48 +98,74 @@ jobs:

- name: Load Components and Platforms
run: |
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
components=$(jq -c '.components' ${CONFIG_FILE})
fi
cp "$CONFIG_FILE" updated_config.json

if [[ "$GITHUB_EVENT_NAME" == "pull_request" || "$GITHUB_EVENT_NAME" == "push" ]]; then
all_changed_files=$(jq -c '.' .github/outputs/all_changed_files.json)
if [ "$all_changed_files" != "null" ]; then
components_file="${CONFIG_FILE}"
files_file=".github/outputs/all_changed_files.json"

jq -c --argjson files "$(cat "$files_file")" '
.components |
[ .[] | select(
. as $component |
any($files[];
[ $component.changeset[] as $ch | startswith($ch) ] | any
)
components_file="${CONFIG_FILE}"
files_file=".github/outputs/all_changed_files.json"

jq -c --argjson files "$(cat "$files_file")" '
.components |
[ .[] | select(
. as $component |
any($files[];
[ $component.changeset[] as $ch | startswith($ch) ] | any
)
]
' "$components_file" > /tmp/filtered_components.json
)
]
' "$components_file" > /tmp/filtered_components.json

jq '.components = input' ${CONFIG_FILE} /tmp/filtered_components.json > updated_config.json
jq '.components = input' "$CONFIG_FILE" /tmp/filtered_components.json > updated_config.json
fi
fi

- name: Get Configuration File
uses: netcracker/qubership-workflow-hub/actions/docker-config-resolver@cabbb90e9471163cfac84bd50ff0296b2803b44c #v2.3.0
uses: netcracker/qubership-workflow-hub/actions/docker-config-resolver@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
id: config
with:
file-path: "updated_config.json"

- name: Create tags for images
uses: netcracker/qubership-workflow-hub/actions/metadata-action@cabbb90e9471163cfac84bd50ff0296b2803b44c #v2.3.0
uses: netcracker/qubership-workflow-hub/actions/metadata-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
id: meta
with:
default-template: "{{ref-name}}"
extra-tags: ${{ github.event.inputs.tags || '' }}
replace-symbol: ${{ github.event.inputs.replace-symbol || '_'}}

build:
name: ${{ matrix.component.name }} Image Build
name: ${{ matrix.component.name }} Image Dry Run
if: needs.prepare.outputs.dry-run == 'true'
needs: [prepare]
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
strategy:
fail-fast: false
matrix:
component: ${{ fromJson(needs.prepare.outputs.packages) }}
steps:
- name: Docker
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
with:
ref: ${{ github.ref }}
dry-run: "true"
download-artifact: false
component: ${{ toJson(matrix.component) }}
platforms: ${{ matrix.component.platforms }}
tags: ${{ needs.prepare.outputs.tags }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish:
name: ${{ matrix.component.name }} Image Publish
if: needs.prepare.outputs.dry-run == 'false' && github.triggering_actor == github.actor
needs: [prepare]
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
packages: write
Expand All @@ -132,10 +175,10 @@ jobs:
component: ${{ fromJson(needs.prepare.outputs.packages) }}
steps:
- name: Docker
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c #v2.3.0
uses: netcracker/qubership-workflow-hub/actions/docker-action@cabbb90e9471163cfac84bd50ff0296b2803b44c # v2.3.0
with:
ref: ${{ github.ref }}
dry-run: ${{ github.event.inputs.dry-run || github.event_name == 'pull_request' }}
dry-run: "false"
download-artifact: false
component: ${{ toJson(matrix.component) }}
platforms: ${{ matrix.component.platforms }}
Expand Down
Loading
Loading