From ef09a2cc3bcf24e7887e72b23451b8e87b36014c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Ruiz?= Date: Fri, 22 Mar 2024 16:39:21 +0100 Subject: [PATCH] Add testing and upload to new approach --- .github/workflows/build-on-push.yml | 3 +- .github/workflows/build_inline.yml | 60 +++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index 995b8f3cc9fbf..f838b8c493f78 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -8,4 +8,5 @@ on: jobs: call-build-workflow: - uses: ./.github/workflows/build_inline.yml \ No newline at end of file + uses: ./.github/workflows/build_inline.yml + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/build_inline.yml b/.github/workflows/build_inline.yml index bb2afb6cc5fa7..1279e7c692bb9 100644 --- a/.github/workflows/build_inline.yml +++ b/.github/workflows/build_inline.yml @@ -47,6 +47,13 @@ on: description: '[ "x64", "arm64" ]' type: string default: '[ "x64" ]' + secrets: + CI_INTERNAL_DEVELOPMENT_BUCKET_USER_ACCESS_KEY: + required: true + description: "AWS user access key" + CI_INTERNAL_DEVELOPMENT_BUCKET_USER_SECRET_KEY: + required: true + description: "AWS user secret key" # ========================== # Bibliography @@ -63,7 +70,7 @@ on: jobs: matrix: - name: Set matrix + name: Set up matrix runs-on: ubuntu-latest outputs: matrix: ${{ steps.setup.outputs.matrix }} @@ -78,7 +85,6 @@ jobs: echo "matrix=$matrix" >> $GITHUB_OUTPUT build: - name: Run build pipeline needs: [matrix] runs-on: ubuntu-latest strategy: @@ -99,17 +105,6 @@ jobs: run: | sudo bash scripts/provision.sh - - name: Run `baptizer.sh` (min) - run: | - name=$(bash scripts/baptizer.sh -m \ - -a ${{ matrix.architecture }} \ - -d ${{ matrix.distribution }} \ - -r ${{ inputs.revision }} \ - ${{ inputs.is_release && '-x' || '' }} \ - ) - echo "name=$name" >> $GITHUB_OUTPUT - id: min_package - - name: Run `baptizer.sh` run: | name=$(bash scripts/baptizer.sh \ @@ -123,13 +118,31 @@ jobs: - name: Run `build.sh` run: | - mkdir -p ./artifacts/dist - touch ./artifacts/dist/${{ steps.min_package.outputs.name }} + bash scripts/build.sh \ + -a ${{ matrix.architecture }} \ + -d ${{ matrix.distribution }} \ + -r ${{ inputs.revision }} - name: Run `assemble.sh` run: | - mkdir -p ./artifacts/dist - touch ./artifacts/dist/${{ steps.package.outputs.name }} + bash scripts/assemble.sh \ + -a ${{ matrix.architecture }} \ + -d ${{ matrix.distribution }} \ + -r ${{ inputs.revision }} + + - name: Test RPM package + if: ${{ matrix.distribution == 'rpm' }} + uses: addnab/docker-run-action@v3 + with: + image: redhat/ubi9:latest + options: -v ${{ github.workspace }}/artifacts/dist:/artifacts/dist + run: | + yum localinstall "/artifacts/dist/${{ steps.package.outputs.name }}" -y + + - name: Test DEB package + if: ${{ matrix.distribution == 'deb' }} + run: | + sudo dpkg -i "artifacts/dist/${{ steps.package.outputs.name }}" -y - name: Upload artifact uses: actions/upload-artifact@v4 @@ -137,3 +150,16 @@ jobs: name: ${{ steps.package.outputs.name }} path: artifacts/dist/${{ steps.package.outputs.name }} if-no-files-found: error + + - name: Set up AWS CLI + uses: aws-actions/configure-aws-credentials@v1 + 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: us-east-1 + + - name: Upload package to S3 + run: | + src="artifacts/dist/${{ steps.package.outputs.name }}" + dest="s3://packages-dev.internal.wazuh.com/development/wazuh/4.x/main/packages/" + aws s3 cp "$src" "$dest"