diff --git a/.github/workflows/debian-cache.yml b/.github/workflows/debian-cache.yml index 6b8d7ee..8641017 100644 --- a/.github/workflows/debian-cache.yml +++ b/.github/workflows/debian-cache.yml @@ -22,20 +22,20 @@ jobs: run: go build - name: Cache - run: ./out-of-tree --log-level=trace debian cache --path=/home/runner/debian.cache + run: ./out-of-tree --log-level=trace distro debian cache --path=/home/runner/debian.cache - name: Install s3cmd run: sudo apt install s3cmd - - name: Upload cache - run: s3cmd put --acl-public /home/runner/debian.cache s3://out-of-tree/1.0.0/ --host=fra1.digitaloceanspaces.com --host-bucket='%(bucket)s.fra1.digitaloceanspaces.com' --access_key=${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }} --secret_key=${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }} - - name: Archive cache uses: actions/upload-artifact@v3 with: name: debian-cache path: /home/runner/debian.cache + - name: Upload cache + run: s3cmd put --acl-public /home/runner/debian.cache s3://out-of-tree/1.0.0/ --host=fra1.digitaloceanspaces.com --host-bucket='%(bucket)s.fra1.digitaloceanspaces.com' --access_key=${{ secrets.DIGITALOCEAN_SPACES_ACCESS_KEY }} --secret_key=${{ secrets.DIGITALOCEAN_SPACES_SECRET_KEY }} + - name: Archive logs if: always() uses: actions/upload-artifact@v3 diff --git a/debian.go b/distro.go similarity index 79% rename from debian.go rename to distro.go index addda9a..024efdc 100644 --- a/debian.go +++ b/distro.go @@ -6,17 +6,23 @@ import ( "code.dumpstack.io/tools/out-of-tree/distro/debian" ) +type DistroCmd struct { + Debian DebianCmd `cmd:""` +} + type DebianCmd struct { Cache DebianCacheCmd `cmd:"" help:"populate cache"` } type DebianCacheCmd struct { - Path string `help:"path to cache" default:"debian.cache"` + Path string `help:"path to cache"` Refetch int `help:"days before refetch versions without deb package" default:"7"` } func (cmd *DebianCacheCmd) Run() (err error) { - debian.CachePath = cmd.Path + if cmd.Path != "" { + debian.CachePath = cmd.Path + } debian.RefetchDays = cmd.Refetch log.Info().Msg("Fetching kernels...") diff --git a/main.go b/main.go index 705be50..f352705 100644 --- a/main.go +++ b/main.go @@ -48,7 +48,7 @@ type CLI struct { Gen GenCmd `cmd:"" help:"generate .out-of-tree.toml skeleton"` Image ImageCmd `cmd:"" help:"manage images"` Container ContainerCmd `cmd:"" help:"manage containers"` - Debian DebianCmd `cmd:"" help:"" hidden:""` + Distro DistroCmd `cmd:"" help:"distro-related helpers" hidden:""` Version VersionFlag `name:"version" help:"print version information and quit"`