From 7a4c0cf54b729eeeb9c7733af629b9865b0f618b Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 28 Nov 2023 10:28:12 +0100 Subject: [PATCH] Hardcode bucket name and get tag from env --- .github/workflows/merge-to-master.yml | 63 ++++++++------------------- upload-win-packages/upload.py | 9 ++-- 2 files changed, 21 insertions(+), 51 deletions(-) diff --git a/.github/workflows/merge-to-master.yml b/.github/workflows/merge-to-master.yml index f74190f2..a74fcc63 100644 --- a/.github/workflows/merge-to-master.yml +++ b/.github/workflows/merge-to-master.yml @@ -14,18 +14,20 @@ jobs: # tag: "tmp-pr-${{ steps.get_pr_number.outputs.result }}" steps: - name: Get PR number - uses: actions/github-script@v6 +# uses: actions/github-script@v6 id: get_pr_number - with: - script: | - return ( - await github.rest.repos.listPullRequestsAssociatedWithCommit({ - commit_sha: context.sha, - owner: context.repo.owner, - repo: context.repo.repo, - }) - ).data[0].number; - result-encoding: string + run: | + echo 'what' + # with: +# script: | +# return ( +# await github.rest.repos.listPullRequestsAssociatedWithCommit({ +# commit_sha: context.sha, +# owner: context.repo.owner, +# repo: context.repo.repo, +# }) +# ).data[0].number; +# result-encoding: string # publish-linux: # name: Publish linux packages to staging and production buckets @@ -67,38 +69,7 @@ jobs: publish-windows: name: Publish windows packages to logging's production bucket needs: get-release-tag - runs-on: ubuntu-latest - permissions: - id-token: write - contents: read - - steps: - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - role-duration-seconds: 10800 # default to 1 hour, which might not suffice https://github.com/aws-actions/configure-aws-credentials#credential-lifetime - aws-region: us-east-2 - - - name: Launch Fargate task - uses: newrelic/fargate-runner-action@main - with: - aws_region: us-east-2 - container_make_target: "upload-win-packages" - ecs_cluster_name: infra-agent-fb-e2e-testing - task_definition_name: infra-agent-fb-e2e-testing - cloud_watch_logs_group_name: infra-agent-fb-e2e-testing - # The log stream name must follow the {cloudwatch_log_prefix}/{container_name} - # that was used to create the ECS infrastructure. "ecs" is the default cloudwatch_log_prefix - # when not specified, and our container_name is infra-agent-fb-e2e-testing - cloud_watch_logs_stream_name: ecs/infra-agent-fb-e2e-testing - aws_vpc_subnet: subnet-06240c469195932cf - aws_vpc_security_groups: | - sg-0c4318be91bbe3cba - repo_name: "newrelic/fluent-bit-package" - ref: ${{ needs.get-release-tag.outputs.tag }} - task_environment: - - name: TAG - value: ${{ needs.get-release-tag.outputs.tag }} - - name: AWS_S3_BUCKET_NAME - value: "logging-fb-windows-packages" + uses: ./.github/workflows/run_task.yml + with: + container_make_target: "upload-win-packages" + secrets: inherit diff --git a/upload-win-packages/upload.py b/upload-win-packages/upload.py index 8eeec46f..cf08b62b 100644 --- a/upload-win-packages/upload.py +++ b/upload-win-packages/upload.py @@ -29,8 +29,7 @@ def upload_file(file_name, bucket): logging.error(e) if __name__ == "__main__": - token = os.environ['GITHUB_TOKEN'] - asset_names = download_win_packages_from_gh_release(token) - bucket_name = os.environ['AWS_S3_BUCKET_NAME'] - for asset_name in asset_names: - upload_file(asset_name, 'fluent-bit-package') + print(os.environ['REF']) + # asset_names = download_win_packages_from_gh_release(os.environ['GITHUB_TOKEN'], os.environ['REF']) + # for asset_name in asset_names: + # upload_file(asset_name, 'logging-fb-windows-packages')