Skip to content

Commit

Permalink
generate-linux-schema-file
Browse files Browse the repository at this point in the history
  • Loading branch information
luckslovez committed Nov 14, 2023
1 parent 41584ad commit c3e74b2
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/merge-to-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Merge to master

on:
push:
branches:
- test_main

jobs:
cd:
name: Promote pre-release to release and publish artifacts to production repositories
runs-on: ubuntu-latest

steps:
- 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

- name: Download windows packages
run: |
gh release download ${{ steps.get_pr_number.outputs.result }} --pattern 'fb-windows-*.zip'
- name: Publish assets to windows S3
uses: newrelic/[email protected]
env:
TAG: ${{ github.event.inputs.tag }}
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 }}
with:
tag: ${{env.TAG}}
app_name: ${{env.FB_PACKAGE_NAME}}
repo_name: "newrelic/fluent-bit-package"
schema: "custom"
schema_url: "https://raw.githubusercontent.com/newrelic/fluent-bit-package/main/schemas/fb-linux.yml"
aws_access_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws_s3_bucket_name: ${{ env.AWS_S3_BUCKET_NAME }}
aws_s3_lock_bucket_name: ${{ env.AWS_S3_LOCK_BUCKET_NAME }}
access_point_host: "staging"
run_id: ${{ github.run_id }}
aws_region: ${{ env.AWS_REGION }}
aws_role_session_name: ${{ env.AWS_ROLE_SESSION_NAME }}
aws_role_arn: ${{ env.AWS_ROLE_ARN }}
# used for signing package stuff
gpg_passphrase: ${{ env.GPG_PASSPHRASE }}
gpg_private_key_base64: ${{ env.GPG_PRIVATE_KEY_BASE64 }}

run_e2e_tests:
needs: [ setup_environment, sign_suse_packages, upload_official_packages_to_prerelease ]
name: Run E2E tests
uses: ./.github/workflows/run_e2e_tests.yml
with:
gh_release_name: ${{ needs.setup_environment.outputs.pre_release_name }}
infra_agent_version: latest
secrets: inherit

provision_and_execute_tests:
name: Provision instances and run tests
needs: spin_up_test_executor_instances
uses: ./.github/workflows/run_task.yml
with:
container_make_target: "ansible/provision-and-execute-tests PR_NUMBER=${{ github.event.pull_request.number }}"
secrets: inherit
5 changes: 5 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ jobs:
echo "linux_and_windows_matrix=$( cat versions/linuxAndWindowsMatrix.json )" >> "$GITHUB_OUTPUT"
echo "sles_matrix=$( cat versions/slesMatrix.json )" >> "$GITHUB_OUTPUT"
- name: Compute and upload schemas
run: |
make schemas;
gh release upload ${{ env.PRE_RELEASE_NAME }} schemas/generated-linux-schema.yaml --repo newrelic/fluent-bit-package
# Downloads all Fluent Bit packages that are officially supported, preferably from the New Relic Infrastructure Agent
# repository (Linux packages, already re-signed by NR) or Logging's S3 bucket (Windows packages, already packaged for the NRIA).
# If these are not available, they are downloaded from the official Fluent Bit repository and repackaged to be used by the NRIA.
Expand Down
5 changes: 5 additions & 0 deletions schemas/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.DEFAULT_GOAL := generateSchemas

.PHONY: generateSchemas
generateSchemas:
python3 schema.linux.py > generated-linux-schema.yaml
30 changes: 30 additions & 0 deletions schemas/schema.linux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import json

if __name__ == '__main__':
matrix = open('../versions/strategyMatrix.json')
matrixData = json.load(matrix)
schemaObjectArray = []
print(matrixData[0])
# for item in matrixData:
# type = item['nrPackageUrl'].split('/')[5]
# arch = 'amd64' if (item['arch'] == 'x86_64' or 'amd64') else 'arm64'
# schemaObject = {
# 'src': item['targetPackageName'],
# 'arch': [
# item['arch']
# ],
# 'uploads': [
# {
# 'type': type,
# 'src_repo': '{access_point_host}/infrastructure_agent/linux/' + type,
# 'dest': '{dest_prefix}linux/' + type + '/',
# 'os_version': [
# item['osVersion']
# ]
# }
# ]
# }
# schemaObjectArray.append(schemaObject)
#
# print(schemaObjectArray)
matrix.close()

0 comments on commit c3e74b2

Please sign in to comment.