From 0c01f208e34cbfc29e04273928a321c9f79265c5 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 1 Apr 2026 07:59:10 -0400 Subject: [PATCH 1/3] move getting API key so Slack webhook gets it * getting the API key from env needs to be before the first time the API key is used, which is within the Slack decorator --- end_of_run_workflow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/end_of_run_workflow.py b/end_of_run_workflow.py index e709cc8..4ac4b3d 100644 --- a/end_of_run_workflow.py +++ b/end_of_run_workflow.py @@ -41,6 +41,10 @@ def end_of_run_workflow(stop_doc, api_key=None, dry_run=False): # Get the uid. uid = stop_doc["run_start"] + # Get Tiled API key, if not set already + if not api_key: + api_key = get_api_key_from_env() + # Get the scan_id. run = get_run(uid, api_key=api_key) scan_id = run.start["scan_id"] @@ -81,8 +85,6 @@ def log_completion(): @slack def end_of_run_workflow(stop_doc, api_key=None, dry_run=False): uid = stop_doc["run_start"] - if not api_key: - api_key = get_api_key_from_env() # data_validation(uid, return_state=True, api_key=api) xanes_exporter(uid, api_key=api_key, dry_run=dry_run) From 228a0b81f9f69dc761d3d8e2d4e65c53d751ef61 Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 1 Apr 2026 08:00:46 -0400 Subject: [PATCH 2/3] for testing, use branch with API key fix --- .github/workflows/publish-ghcr.yml | 2 +- prefect.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index 45e4f05..a5e265a 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -4,7 +4,7 @@ name: Create and publish a Docker image # Configures this workflow to run every time a change is pushed to the branch called `release`. on: push: - branches: ["main"] + branches: ["fix-api-key"] # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: diff --git a/prefect.yaml b/prefect.yaml index 36ac550..e7f5c30 100644 --- a/prefect.yaml +++ b/prefect.yaml @@ -10,7 +10,7 @@ pull: directory: /repo - prefect.deployments.steps.git_clone: repository: https://github.com/nsls2/srx-workflows.git - branch: main + branch: fix-api-key deployments: - name: srx-end-of-run-workflow-docker @@ -24,7 +24,7 @@ deployments: schedule: {} work_pool: job_variables: - image: ghcr.io/nsls2/srx-workflows:main + image: ghcr.io/nsls2/srx-workflows:fix-api-key image_pull_policy: Always network: slirp4netns volumes: From 798ed39de71db291487f1389be8f942eca76389c Mon Sep 17 00:00:00 2001 From: Jun Aishima Date: Wed, 1 Apr 2026 08:16:59 -0400 Subject: [PATCH 3/3] Revert "for testing, use branch with API key fix" This reverts commit 228a0b81f9f69dc761d3d8e2d4e65c53d751ef61. --- .github/workflows/publish-ghcr.yml | 2 +- prefect.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml index a5e265a..45e4f05 100644 --- a/.github/workflows/publish-ghcr.yml +++ b/.github/workflows/publish-ghcr.yml @@ -4,7 +4,7 @@ name: Create and publish a Docker image # Configures this workflow to run every time a change is pushed to the branch called `release`. on: push: - branches: ["fix-api-key"] + branches: ["main"] # Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. env: diff --git a/prefect.yaml b/prefect.yaml index e7f5c30..36ac550 100644 --- a/prefect.yaml +++ b/prefect.yaml @@ -10,7 +10,7 @@ pull: directory: /repo - prefect.deployments.steps.git_clone: repository: https://github.com/nsls2/srx-workflows.git - branch: fix-api-key + branch: main deployments: - name: srx-end-of-run-workflow-docker @@ -24,7 +24,7 @@ deployments: schedule: {} work_pool: job_variables: - image: ghcr.io/nsls2/srx-workflows:fix-api-key + image: ghcr.io/nsls2/srx-workflows:main image_pull_policy: Always network: slirp4netns volumes: