Skip to content

Commit

Permalink
more cleanup, add cron
Browse files Browse the repository at this point in the history
  • Loading branch information
manveru committed Oct 9, 2023
1 parent ec93e74 commit 250dc4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
branches:
- main
pull_request:
schedule:
- cron: "14 14 * * 1-5"
permissions:
contents: read
pull-requests: read
Expand Down
11 changes: 8 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ packages *ARGS:
./packages.cr \
--to "s3://devx?secret-key=hydra_key&endpoint=${S3_ENDPOINT}&region=auto&compression=zstd" \
--from-store https://cache.iog.io \
--nix-store "${NIX_STORE}" \
--systems x86_64-linux

# Based on releases.json, upload the CA contents and update packages.json
ci:
just rclone copy s3://devx/capkgs cache
@just cache-download
just packages
just rclone sync cache s3://devx/capkgs
@just cache-upload

cache-download:
@just rclone copy s3://devx/capkgs cache

cache-upload:
@just rclone sync cache s3://devx/capkgs

rclone *ARGS:
#!/usr/bin/env nu
Expand Down
8 changes: 2 additions & 6 deletions packages.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require "file_utils"
class Config
property from_store : String?
property to : String?
property nix_store : String?
property systems : Array(String)?

def parse
Expand All @@ -17,7 +16,6 @@ class Config
parser.on "--from-store=URL", "Public cache URL that users fetch closures from" { |v| @from_store = v }
parser.on "--to=URL", "Nix store URL to copy CA outputs to" { |v| @to = v }
parser.on "--systems=A,B", "systems to process" { |v| @systems = v.split.map(&.strip) }
parser.on "--nix-store=STORE", "store URI" { |v| @nix_store = v }

parser.on "-h", "--help", "Show this help" do
puts parser
Expand All @@ -28,18 +26,16 @@ class Config
raise "Missing required flag: --from-store" unless from_store_value = @from_store
raise "Missing required flag: --to" unless to_value = @to
raise "Missing required flag: --systems" unless systems_value = @systems
raise "Missing required flag: --nix-store" unless nix_store_value = @nix_store

Valid.new(from_store_value, to_value, systems_value, nix_store_value)
Valid.new(from_store_value, to_value, systems_value)
end

struct Valid
property from_store : String
property to : String
property systems : Array(String)
property nix_store : String

def initialize(@from_store, @to, @systems, @nix_store)
def initialize(@from_store, @to, @systems)
end
end
end
Expand Down

0 comments on commit 250dc4d

Please sign in to comment.