Skip to content

Commit

Permalink
ci: flow to list files/pkgs in staging bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenruizdegauna committed Jan 8, 2025
1 parent 3dc50cc commit 31b8bab
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/repository_lastet_added_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
description: 'UTC Date and time to show files added before and after (YYYY-MM-DD HH:MM:SS)'
type: string
required: true
environment:
type: choice
required: true
description: 'Environment to run the action'
options:
- staging
- production
default: 'staging'

jobs:
list-files:
Expand All @@ -31,11 +39,22 @@ jobs:
exit 1
fi

- name: List files created before and after datetime in S3
- name: List files created before and after datetime in Production S3
if: ${{ github.event.inputs.environment == 'production' }}
run: |
TZ="UTC" aws s3 ls s3://nr-downloads-main/infrastructure_agent/ --recursive | sort | grep --color -m 1 -C {{ github.event.inputs.count }} "^${{ github.event.inputs.date_time }}"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_PRODUCTION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
AWS_ROLE_ARN: ${{ secrets.OHAI_AWS_ROLE_ARN_PRODUCTION }}
AWS_ROLE_SESSION_NAME: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_PRODUCTION }}

- name: List files created before and after datetime in Staging S3
if: ${{ github.event.inputs.environment == 'staging' }}
run: |
TZ="UTC" aws s3 ls s3://nr-downloads-ohai-staging/infrastructure_agent/ --recursive | sort | grep --color -m 1 -C {{ github.event.inputs.count }} "^${{ github.event.inputs.date_time }}"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_STAGING }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_STAGING }}
AWS_ROLE_ARN: ${{ secrets.OHAI_AWS_ROLE_ARN_STAGING }}
AWS_ROLE_SESSION_NAME: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_STAGING }}
22 changes: 21 additions & 1 deletion .github/workflows/repository_lastet_added_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,37 @@ on:
type: string
default: '1000'
required: true
environment:
type: choice
required: true
description: 'Environment to run the action'
options:
- staging
- production
default: 'staging'


jobs:
list-packages:
name: List latest added packages into the S3 repository
runs-on: ubuntu-20.04
steps:
- name: List latest packages in S3
- name: List latest packages in Production S3
if: ${{ github.event.inputs.environment == 'production' }}
run: |
TZ="UTC" aws s3 ls s3://nr-downloads-main/infrastructure_agent/ --recursive | sort | grep -E "\.(rpm|deb)$" | tail -n ${{ github.event.inputs.count }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_PRODUCTION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
AWS_ROLE_ARN: ${{ secrets.OHAI_AWS_ROLE_ARN_PRODUCTION }}
AWS_ROLE_SESSION_NAME: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_PRODUCTION }}

- name: List latest packages in Staging S3
if: ${{ github.event.inputs.environment == 'staging' }}
run: |
TZ="UTC" aws s3 ls s3://nr-downloads-ohai-staging/infrastructure_agent/ --recursive | sort | grep -E "\.(rpm|deb)$" | tail -n ${{ github.event.inputs.count }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_STAGING }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_STAGING }}
AWS_ROLE_ARN: ${{ secrets.OHAI_AWS_ROLE_ARN_STAGING }}
AWS_ROLE_SESSION_NAME: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_STAGING }}

0 comments on commit 31b8bab

Please sign in to comment.