Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Command Manager plugin to the build workflow #408

Merged
merged 4 commits into from
Sep 16, 2024
Merged
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
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,24 @@ jobs:
- id: setup
run: |
matrix=$(jq -cn \
--argjson distribution '${{ github.event.inputs.distribution }}' \
--argjson architecture '${{ github.event.inputs.architecture }}' \
--argjson distribution '${{ inputs.distribution }}' \
--argjson architecture '${{ inputs.architecture }}' \
'{distribution: $distribution, architecture: $architecture}'
)
echo "matrix=$matrix" >> $GITHUB_OUTPUT

build-plugins:
if: ${{ github.event.inputs.plugins_reference != '' }}
if: ${{ inputs.plugins_reference != '' }}
strategy:
fail-fast: false
matrix:
plugins: ["wazuh-indexer-setup"]
plugins: ["setup", "command-manager"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: wazuh/wazuh-indexer-plugins
ref: ${{ github.event.inputs.plugins_reference }}
ref: ${{ inputs.plugins_reference }}
- uses: actions/setup-java@v4
with:
distribution: temurin
Expand All @@ -134,16 +134,16 @@ jobs:
run: echo "version=$(<VERSION)" >> "$GITHUB_OUTPUT"

- name: Build with Gradle
working-directory: .//plugins/${{ matrix.plugins }}
working-directory: ./plugins/${{ matrix.plugins }}
run: |
./gradlew build -Dversion=${{ steps.version.outputs.version }} -Drevision=${{ github.event.inputs.revision }}
./gradlew build -Dversion=${{ steps.version.outputs.version }} -Drevision=${{ inputs.revision }}
ls -lR build/distributions/

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.plugins }}
path: "./plugins/${{ matrix.plugins }}/build/distributions/${{ matrix.plugins }}-${{ steps.version.outputs.version }}.${{ github.event.inputs.revision }}.zip"
path: "./plugins/${{ matrix.plugins }}/build/distributions/wazuh-indexer-${{ matrix.plugins }}-${{ steps.version.outputs.version }}.${{ inputs.revision }}.zip"
if-no-files-found: error

build:
Expand All @@ -157,13 +157,13 @@ jobs:

# Download plugins
- uses: actions/download-artifact@v4
if: ${{ github.event.inputs.plugins_reference != '' }}
if: ${{ inputs.plugins_reference != '' }}
with:
path: ./artifacts/plugins
merge-multiple: true

- name: Display structure of downloaded files
if: ${{ github.event.inputs.plugins_reference != '' }}
if: ${{ inputs.plugins_reference != '' }}
run: ls -lR ./artifacts/plugins

- uses: actions/setup-java@v4
Expand All @@ -184,8 +184,8 @@ jobs:
name=$(bash build-scripts/baptizer.sh -m \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ github.event.inputs.revision }} \
${{ github.event.inputs.is_stage && '-x' || '' }} \
-r ${{ inputs.revision }} \
${{ inputs.is_stage && '-x' || '' }} \
)
echo "name=$name" >> $GITHUB_OUTPUT
id: min_package
Expand All @@ -195,8 +195,8 @@ jobs:
name=$(bash build-scripts/baptizer.sh \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ github.event.inputs.revision }} \
${{ github.event.inputs.is_stage && '-x' || '' }} \
-r ${{ inputs.revision }} \
${{ inputs.is_stage && '-x' || '' }} \
)
echo "name=$name" >> $GITHUB_OUTPUT
id: package
Expand All @@ -213,7 +213,7 @@ jobs:
bash build-scripts/assemble.sh \
-a ${{ matrix.architecture }} \
-d ${{ matrix.distribution }} \
-r ${{ github.event.inputs.revision }}
-r ${{ inputs.revision }}

- name: Test RPM package
if: ${{ matrix.distribution == 'rpm' }}
Expand All @@ -237,15 +237,15 @@ jobs:
if-no-files-found: error

- name: Set up AWS CLI
if: ${{ github.event.inputs.upload }}
if: ${{ inputs.upload }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
aws-region: ${{ secrets.CI_AWS_REGION }}

- name: Upload package to S3
if: ${{ github.event.inputs.upload }}
if: ${{ inputs.upload }}
run: |
src="artifacts/dist/${{ steps.package.outputs.name }}"
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/"
Expand All @@ -254,7 +254,7 @@ jobs:
echo "S3 URI: ${s3uri}"

- name: Upload checksum to S3
if: ${{ github.event.inputs.upload && github.event.inputs.checksum }}
if: ${{ inputs.upload && inputs.checksum }}
run: |
src="artifacts/dist/${{ steps.package.outputs.name }}.sha512"
dest="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/"
Expand Down