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

Use centralized scripts with S3 interactions #167

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/rebuild-all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Repository Dispatch
run: ./ingest/vendored/trigger monkeypox rebuild
run: ./ingest/vendored/trigger nextstrain/monkeypox rebuild
env:
PAT_GITHUB_DISPATCH: ${{ secrets.GH_TOKEN_NEXTSTRAIN_BOT_WORKFLOW_DISPATCH }}
36 changes: 0 additions & 36 deletions ingest/bin/download-from-s3

This file was deleted.

36 changes: 0 additions & 36 deletions ingest/bin/notify-on-diff

This file was deleted.

55 changes: 0 additions & 55 deletions ingest/bin/notify-on-record-change

This file was deleted.

30 changes: 0 additions & 30 deletions ingest/bin/trigger-on-new-data

This file was deleted.

79 changes: 0 additions & 79 deletions ingest/bin/upload-to-s3

This file was deleted.

4 changes: 2 additions & 2 deletions ingest/vendored/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/nextstrain/ingest
branch = main
commit = 5d908187d13cbce27253af5163b4803d6bac03a6
parent = 79e690f465cfafc68157c18b499daf10c36b648d
commit = 1eb8b30428d5f66adac201f0a246a7ab4bdc9792
parent = a7ccb51fecede6336ef06ec2a980db27aa5821b4
method = merge
cmdver = 0.4.6
8 changes: 4 additions & 4 deletions ingest/vendored/trigger
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

: "${PAT_GITHUB_DISPATCH:=}"

repo="${1:?A repository name is required as the first argument.}"
github_repo="${1:?A GitHub repository with owner and repository name is required as the first argument.}"
event_type="${2:?An event type is required as the second argument.}"
shift 2

Expand All @@ -12,7 +12,7 @@ if [[ $# -eq 0 && -z $PAT_GITHUB_DISPATCH ]]; then
You must specify options to curl for your GitHub credentials. For example, you
can specify your GitHub username, and will be prompted for your password:

$0 $repo $event_type --user <your-github-username>
$0 $github_repo $event_type --user <your-github-username>

Be sure to enter a personal access token¹ as your password since GitHub has
discontinued password authentication to the API starting on November 13, 2020².
Expand All @@ -26,7 +26,7 @@ file³:

and then tell curl to use it:

$0 $repo $event_type --netrc
$0 $github_repo $event_type --netrc

which will then not require you to type your password every time.

Expand All @@ -42,7 +42,7 @@ if [[ -n $PAT_GITHUB_DISPATCH ]]; then
auth="Authorization: Bearer ${PAT_GITHUB_DISPATCH}"
fi

if curl -fsS "https://api.github.com/repos/nextstrain/${repo}/dispatches" \
if curl -fsS "https://api.github.com/repos/${github_repo}/dispatches" \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Content-Type: application/json' \
-H "$auth" \
Expand Down
4 changes: 2 additions & 2 deletions ingest/vendored/trigger-on-new-data
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail

bin="$(dirname "$0")"

repo="${1:?A repository name is required as the first argument.}"
github_repo="${1:?A GitHub repository with owner and repository name is required as the first argument.}"
event_type="${2:?An event type is required as the second argument.}"
metadata="${3:?A metadata upload output file is required as the third argument.}"
sequences="${4:?An sequence FASTA upload output file is required as the fourth argument.}"
Expand All @@ -19,7 +19,7 @@ slack_message=""
# grep exit status 0 for found match, 1 for no match, 2 if an error occurred
if [[ $new_metadata -eq 1 || $new_sequences -eq 1 ]]; then
slack_message="Triggering new builds due to updated metadata and/or sequences"
"$bin"/trigger "$repo" "$event_type"
"$bin"/trigger "$github_repo" "$event_type"
elif [[ $new_metadata -eq 0 && $new_sequences -eq 0 ]]; then
slack_message="Skipping trigger of rebuild: Both metadata TSV and sequences FASTA are identical to S3 files."
else
Expand Down
4 changes: 2 additions & 2 deletions ingest/workflow/snakemake_rules/slack_notifications.smk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rule notify_on_genbank_record_change:
s3_src=S3_SRC,
shell:
"""
./bin/notify-on-record-change {input.genbank_ndjson} {params.s3_src:q}/genbank.ndjson.xz Genbank
./vendored/notify-on-record-change {input.genbank_ndjson} {params.s3_src:q}/genbank.ndjson.xz Genbank
"""


Expand All @@ -43,7 +43,7 @@ rule notify_on_metadata_diff:
s3_src=S3_SRC,
shell:
"""
./bin/notify-on-diff {input.metadata} {params.s3_src:q}/metadata.tsv.gz
./vendored/notify-on-diff {input.metadata} {params.s3_src:q}/metadata.tsv.gz
"""


Expand Down
2 changes: 1 addition & 1 deletion ingest/workflow/snakemake_rules/trigger_rebuild.smk
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ rule trigger_build:
touch("data/trigger/rebuild.done")
shell:
"""
./bin/trigger-on-new-data {input.metadata_upload} {input.fasta_upload}
./vendored/trigger-on-new-data nextstrain/monkeypox rebuild {input.metadata_upload} {input.fasta_upload}
"""
2 changes: 1 addition & 1 deletion ingest/workflow/snakemake_rules/upload.smk
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ rule upload_to_s3:
cloudfront_domain=config["upload"].get("s3", {}).get("cloudfront_domain", ""),
shell:
"""
./bin/upload-to-s3 \
./vendored/upload-to-s3 \
{params.quiet} \
{input.file_to_upload:q} \
{params.s3_dst:q}/{wildcards.remote_file_name:q} \
Expand Down