Commit 33582e5
feat: optimize S3 lifecycle management and modernize infrastructure configuration (#170)
* feat: add S3 lifecycle management for cost optimization and automated cleanup
This commit implements comprehensive S3 lifecycle rules for the nf-core-awsmegatests bucket to optimize storage costs and automatically clean up temporary workflow files.
Changes:
- Add create_s3_lifecycle_configuration() function with 4 lifecycle rules
- Rule 1: Preserve metadata files with cost optimization (IA after 30 days, Glacier after 90 days)
- Rule 2: Clean up temporary files after 30 days (based on nextflow.io/temporary tag)
- Rule 3: Clean up work directory after 90 days (prefix-based cleanup)
- Rule 4: Clean up incomplete multipart uploads after 7 days
The implementation includes proper error handling to gracefully fall back to manual management if AWS permissions are insufficient.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor: remove all try/except statements to let Pulumi handle errors natively
This commit removes all manual try/except error handling blocks throughout the codebase, allowing Pulumi to handle errors using its built-in error management system.
Changes:
- Remove try/except from S3 lifecycle configuration creation
- Remove try/except from Seqera compute environment deployment
- Remove try/except from GitHub integration resource creation
- Remove try/except from Seqera provider initialization
- Remove try/except from TowerForge credential upload
- Remove try/except from configuration file loading
- Remove try/except from workspace ID validation
- Remove unused validate_environment() function
- Simplify numeric validation logic in settings
Pulumi's native error handling provides better diagnostics and stack traces than custom exception wrapping. This simplifies the codebase while maintaining robust error reporting.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: optimize S3 bucket lifecycle and enable CORS for Seqera Data Explorer
- Update work directory cleanup from 90 days to 14 days for aggressive cost optimization
- Add lifecycle rules for scratch/ (7 days) and cache/ directories (30 days)
- Enable CORS configuration for Seqera Data Explorer compatibility
- Add one-time batch job script for tagging existing log files
- Preserve tagged log files while aggressively cleaning untagged work files
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: adjust S3 lifecycle cleanup to be less aggressive
- Update work directory cleanup from 14 days to 30 days
- Update scratch directory cleanup from 7 days to 30 days
- Maintain 30-day cleanup for cache directories
- Keep tagged log files preserved for 90 days with storage transitions
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* refactor: externalize nextflow configuration to separate files
- Move embedded nextflowConfig strings from JSON to external .config files
- Create modular nextflow configs with base + environment-specific settings
- Add load_nextflow_config() function to read external config files
- Update compute environment creation to use external nextflow configs
- Clean JSON files by removing embedded nextflowConfig fields
- Improve maintainability and readability of nextflow configurations
Config structure:
- nextflow-base.config: Common settings (AWS Batch, error handling, fusion tags)
- nextflow-cpu.config: CPU-specific settings (x86_64, CPU tags)
- nextflow-gpu.config: GPU-specific settings (x86_64, GPU tags)
- nextflow-arm.config: ARM-specific settings (arm64, ARM tags)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* chore: update Seqera Terraform provider version to 0.25.2
- Update provider version from 0.13.0 to 0.25.2
- Attempt to resolve pulumi_seqera module import issues
- Provider configuration ready but SDK generation still needs resolution
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: generate Seqera Terraform provider SDK and verify infrastructure changes
- Generate pulumi-seqera SDK from terraform-provider registry.terraform.io/seqeralabs/seqera
- Add pulumi-seqera dependency with local SDK path configuration
- Update package dependencies and lock file with generated SDK
- Verify infrastructure changes work correctly with pulumi preview:
* S3 CORS configuration for Seqera Data Explorer ✅
* S3 lifecycle optimization with 30-day cleanup ✅
* External nextflow config files integration ✅
* Compute environment replacements with updated configs ✅
All infrastructure optimizations tested and ready for deployment.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: correct Seqera provider version to 0.25.2
- Fix provider version that was incorrectly reverted to 0.13.0
- Ensure we're using the latest Seqera provider version 0.25.2 as intended
- SDK generation accidentally used older version, now corrected
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: correct S3 CORS configuration to comply with AWS and Seqera requirements
- Remove unsupported x-amz-meta-* wildcard from ExposeHeaders
- Simplify ExposeHeaders to only include ETag per Seqera documentation
- Update documentation link to correct Seqera Data Explorer CORS guide
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* fix: add missing EC2 permissions to TowerForge IAM policy
Add ec2:DescribeAccountAttributes, ec2:DescribeLaunchTemplateVersions,
and ec2:DescribeInstanceTypeOfferings permissions to align with the
official Seqera forge policy requirements. This resolves 403 forbidden
errors when Seqera Platform attempts to describe AWS account attributes.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* test: add IAM policy compliance validation against Seqera reference
Add comprehensive unit tests to validate TowerForge IAM policy includes
all required permissions from the official Seqera forge policy. The test:
- Fetches reference policy from seqeralabs/nf-tower-aws repository
- Compares our policy permissions against the reference
- Validates critical EC2 permissions are present
- Ensures proper policy structure
Also adds missing EFS permissions (elasticfilesystem:*) and iam:GetRole
permission that were in the reference policy but missing from ours.
Includes TODO comment for implementing Pulumi CrossGuard policy validation
for automated compliance checking at deployment time.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: add explicit compute environment dependencies and IAM policy change detection
Implement proper dependency management and prevent authorization errors by:
- Add explicit dependencies between IAM resources → Seqera credentials → compute environments
- Generate IAM policy hash to force compute environment recreation on policy changes
- Embed policy version hash in CE descriptions to trigger replacement when policies update
- Pass Seqera credential resource for explicit dependency tracking
This ensures compute environments are always created with fully propagated IAM permissions,
preventing "not authorized" errors during resource creation when policies are updated.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
* feat: implement Python file injection for Nextflow config merging
Replace includeConfig statements with programmatic config merging to resolve
Seqera Platform compatibility issues. Add comprehensive test suite with 10 test cases.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent fc6acda commit 33582e5
File tree
25 files changed
+1639
-278
lines changed- pulumi/AWSMegatests
- scripts
- seqerakit
- configs
- src
- config
- infrastructure
- integrations
- providers
- utils
- tests
- unit
25 files changed
+1639
-278
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
81 | 67 | | |
82 | 68 | | |
83 | 69 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
113 | 76 | | |
114 | 77 | | |
115 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 15 | | |
20 | 16 | | |
21 | 17 | | |
| 18 | + | |
| 19 | + | |
22 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments