Skip to content

Commit 46911ad

Browse files
committed
Upload packages to S3 (#179)
* Attemtp to automate package's testing * Add workflow file to upload packages to S3 * Skip testing to test whether the upload works * Fix package names * Fix upload workflow name * Pass secrets to the reusable workflow * Fix indentation * Fix indentation * Remove test workflow from this PR * Add boolean input to control when the package is uploaded to the S3 bucket * [UI/UX] Improve inputs description --------- Signed-off-by: Álex Ruiz <[email protected]>
1 parent fac56de commit 46911ad

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/build.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ on:
1010
workflow_dispatch:
1111
inputs:
1212
revision:
13-
description: "Any string or number used to extend the package's identifier"
13+
description: "Revision"
1414
type: string
1515
required: true
1616
default: "1"
17+
upload:
18+
description: "Upload ?"
19+
type: bool
20+
default: false
1721

1822
# ==========================
1923
# Bibliography
@@ -74,3 +78,12 @@ jobs:
7478
uses: ./.github/workflows/r_test.yml
7579
with:
7680
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
81+
82+
upload:
83+
needs: [version, commit_sha, test]
84+
# Upload only on 'workflow_dispatch' event and if 'upload=true'
85+
if: ${{ github.event_name == 'push' && inputs.upload }}
86+
uses: ./.github/workflows/r_upload.yml
87+
with:
88+
package: wazuh-indexer-${{ needs.version.outputs.version }}-${{ github.event_name == 'push' && '1' || inputs.revision }}_${{ matrix.os.suffix }}_${{ needs.commit_sha.outputs.commit_sha }}.${{ matrix.os.ext }}
89+
secrets: inherit

.github/workflows/r_upload.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Upload (reusable)
2+
3+
# This workflow runs when any of the following occur:
4+
# - Run from another workflow
5+
on:
6+
workflow_call:
7+
inputs:
8+
package:
9+
description: "The name of the package to upload to Wazuh's S3 development artifactory bucket."
10+
required: true
11+
type: string
12+
secrets:
13+
CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY:
14+
required: true
15+
CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY:
16+
required: true
17+
18+
jobs:
19+
r_upload:
20+
runs-on: ubuntu-latest
21+
# Permissions to upload the package
22+
permissions:
23+
packages: read
24+
contents: read
25+
steps:
26+
- name: Download artifact
27+
uses: actions/download-artifact@v4
28+
with:
29+
name: ${{ inputs.package }}
30+
path: artifacts/dist
31+
32+
- name: Set up AWS CLI
33+
uses: aws-actions/configure-aws-credentials@v1
34+
with:
35+
aws-access-key-id: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY }}
36+
aws-secret-access-key: ${{ secrets.CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY }}
37+
aws-region: us-east-1
38+
39+
- name: Upload package to S3
40+
run: |
41+
aws s3 cp artifacts/dist/${{ inputs.package }} s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/

0 commit comments

Comments
 (0)