Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sponsors): Keep the list of donors up to date. #7387

Merged
merged 25 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e42c369
feat(sponsors): Retrieves donators from lfx.linuxfoundation.org.
gounthar Jun 14, 2024
bd22698
fix(sponsors): Gets rid of the git commit step.
gounthar Jun 14, 2024
a5c0a6d
fix(sponsors): Permissions.
gounthar Jun 14, 2024
99bfa86
fix(sponsors): Removed one donator.
gounthar Jun 14, 2024
b8ef25e
fix(sponsors): Changed TOKEN.
gounthar Jun 14, 2024
c68fac6
fix(sponsors): The workflow is not valid.
gounthar Jun 14, 2024
da57ec4
fix(sponsors): Moe to v6.
gounthar Jun 14, 2024
93322d0
fix(sponsors): Move to v6.
gounthar Jun 14, 2024
c22ebe0
fix(sponsors): Correct git message.
gounthar Jun 14, 2024
a9e1d27
fix(sponsors): Change token.
gounthar Jun 14, 2024
038bbd8
Merge remote-tracking branch 'upstream/master' into retrieve-donators
gounthar Jun 17, 2024
02a8e54
Merge branch 'jenkins-infra:master' into retrieve-donators
gounthar Jun 20, 2024
0777833
fix(ga): Change the GitHub token
gounthar Jun 24, 2024
77e4448
Merge remote-tracking branch 'upstream/master' into retrieve-donators
gounthar Jun 25, 2024
c0ebb80
fix(donators): The commit may be superfluous.
gounthar Jun 25, 2024
e537781
fix(donators): Put back the output information.
gounthar Jun 25, 2024
f09a1e2
fix(donators): Right way to access the token.
gounthar Jun 25, 2024
632821e
fix(donators): Author, just in case.
gounthar Jun 25, 2024
9325291
fix(donators): refactor.
gounthar Jun 25, 2024
4d6ebf6
fix(donors): Clean up.
gounthar Jun 25, 2024
2b95b36
fix(donors): cleanup.
gounthar Jun 25, 2024
3791f52
Merge remote-tracking branch 'upstream/master' into donors
gounthar Jun 26, 2024
a7af874
fix(donors): Add documentation.
gounthar Jun 26, 2024
0726985
Merge branch 'jenkins-infra:master' into donors
gounthar Jun 27, 2024
630cb9f
Merge remote-tracking branch 'upstream/master' into donors
gounthar Jun 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions updatecli/scripts/retrieve-donors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

# This script retrieves transaction data for a specific project from the LFX Crowdfunding API.
# The project is identified by its ID in the API request URL.
# The retrieved data is in JSON format and is saved to a temporary file.
# The script then processes the JSON data to select certain fields and remove others.

# Send a GET request to the LFX Crowdfunding API to retrieve transaction data for a specific project.
# The curl command is used with several options to set various HTTP headers.
# These headers include 'User-Agent', 'Accept', 'Accept-Language', 'Accept-Encoding', 'Origin', 'Connection', 'Sec-Fetch-Dest', 'Sec-Fetch-Mode', 'Sec-Fetch-Site', 'Pragma', 'Cache-Control', and 'TE'.
# These headers control various aspects of the HTTP request, such as the client software, media types, language, encoding, origin, connection, fetch context, caching, and transfer encoding.
curl 'https://api.crowdfunding.lfx.linuxfoundation.org/v1/projects/bce45251-1ff4-4131-9699-0a0017b31495/transactions' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:126.0) Gecko/20100101 Firefox/126.0' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Accept-Language: en-US,en;q=0.5' \
-H 'Accept-Encoding: gzip, deflate, br, zstd' \
-H 'Origin: https://crowdfunding.lfx.linuxfoundation.org' \
-H 'Connection: keep-alive' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-site' \
-H 'Pragma: no-cache' \
-H 'Cache-Control: no-cache' \
-H 'TE: trailers' | jq > /tmp/transactions.json

# Process the JSON data to select certain fields and remove others.
# The jq command is used to filter the JSON data.
# The filter selects entries where the 'type' field is not 'expense'.
# If the 'organizationId' field of the 'organization' object is empty, the 'organization' object is removed.
# The 'merchantName', 'amountInCents', 'feesMerchantInCents', 'feesPlatformInCents', 'creditInCents', 'runningBalanceInCents', 'deltaInCents', 'submitterName', and 'description' fields are removed.
jq '[.entries[] | select(.type != "expense") | if .organization.organizationId == "" then del(.organization) else . end | del(.merchantName, .amountInCents, .feesMerchantInCents, .feesPlatformInCents, .creditInCents, .runningBalanceInCents, .deltaInCents, .submitterName, .description)]' /tmp/transactions.json
60 changes: 60 additions & 0 deletions updatecli/updatecli.d/find-donors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This is a configuration file for the updatecli tool.
# It defines a pipeline for updating the list of Jenkins donors through the LFX platform.
name: Bump the list of Jenkins donors

# The 'scms' section defines the source control management system to be used.
scms:
default:
kind: github
spec:
# The GitHub username
user: "{{ .github.user }}"
# The GitHub user's email
email: "{{ .github.email }}"
# The owner of the GitHub repository
owner: "{{ .github.owner }}"
# The GitHub repository
repository: "{{ .github.repository }}"
# The GitHub token for authentication. It is required.
token: "{{ requiredEnv .github.token }}"
# The GitHub username for authentication
username: "{{ .github.username }}"
# The branch to be updated
branch: "{{ .github.branch }}"

# The 'sources' section defines the sources of data to be used in the pipeline.
sources:
donors:
name: Get the latest list of donors
kind: shell
spec:
# The shell command to retrieve the latest list of donors
command: bash ./updatecli/scripts/retrieve-donors.sh

# The 'targets' section defines the targets to be updated.
targets:
setJenkinsLatestTestURL:
kind: file
spec:
# The file to be updated
file: content/_data/donors/donors.json
# If the file does not exist, it will be created
forcecreate: true
name: "[donors] Update the list of Jenkins donors"
# The source of data for the update
sourceid: donors
# The source control management system to be used
scmid: default

# The 'actions' section defines the actions to be taken after the targets are updated.
actions:
default:
kind: github/pullrequest
scmid: default
title: "[donors] Update the list of Jenkins donors"
spec:
labels: # The labels to be added to the GitHub pull request
- chore
- community
- documentation
- updatecli