sous-chefs / sous-chefs/github

github asset download force does not force

Open
#46 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
25
Forks
25
Avg merge
5h 40m
Merged PRs (30d)
1

Description

Probably a documentation bug:
Setting force to true only has an effect when the action is extract

The desired behaviour however is to force downloading the asset, since in our case the assets get updated. The ideal solution for my use case would be a similar behaviour as remote_file, which can notify if the asset has changed. My current workaround is this:

Also it would be great if the download location could be read from the resource, such as asset.file_path, or alike.

asset = github_asset 'frontend.tar.gz' do
  github_user 'axos88'
  github_token EncryptedCache.fetch('doorlock_github_token')
  owner 'www-data'
  group 'www-data'

  repo 'org/project'
  release 'vLatest'
  action :download
  force true
end

frontend_path = File.join(Chef::Config['file_cache_path'], 'project-frontend.tar.gz')

remote_file frontend_path do
  source "file://#{Chef::Config['file_cache_path']}/github_assets/org/project/vLatest/frontend.tar.gz" #TODO: Extract path from resource definition.
  notifies :extract, "archive_file[#{frontend_path}]", :immediately
end

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the github_asset resource's handling of action :download and force true, then compare the requested behavior with remote_file and archive_file in the example. Check how the asset path is currently derived from Chef::Config['file_cache_path']. Done means downloads can be forced for updated assets and the resource exposes a usable download location or clearly documents the supported behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, ruby
Domain
devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.