Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ARG BUNDLER_VERSION=2.3.13

ARG JEKYLL_ENV=development
ARG DOCS_URL=http://localhost:4000
ARG DOCS_ENFORCE_GIT_LOG_HISTORY=0

# Base stage for building
FROM ruby:${RUBY_VERSION}-alpine AS base
Expand Down Expand Up @@ -45,6 +46,7 @@ COPY --from=vendored /out /
FROM gem AS generate
ARG JEKYLL_ENV
ARG DOCS_URL
ARG DOCS_ENFORCE_GIT_LOG_HISTORY
ENV TARGET=/out
RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/tmp/docker-docs-clone \
Expand Down
14 changes: 10 additions & 4 deletions _plugins/fetch_remote.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def pre_read(site)
beginning_time = Time.now
puts "Starting plugin fetch_remote.rb..."

fetch_depth = get_docs_url == "http://localhost:4000" ? 1 : 0
fetch_depth = get_docs_url == "http://localhost:4000" && ENV['DOCS_ENFORCE_GIT_LOG_HISTORY'] == "0" ? 1 : 0
site.config['fetch-remote'].each do |entry|
puts " Repo #{entry['repo']}"

Expand All @@ -51,10 +51,16 @@ def pre_read(site)
puts " Opening #{clonedir}"
begin
git = Git.open(clonedir)
puts " Fetching #{entry['ref']}"
git.fetch
git.checkout(entry['ref'])
puts " Fetch repository"
if fetch_depth > 0
git.fetch('origin', prune: true, depth: fetch_depth)
else
git.fetch('origin', prune: true)
end
puts " Checkout #{entry['ref']}"
git.checkout(entry['ref'], force: true)
rescue => e
puts " WARNING: #{e}"
FileUtils.rm_rf(clonedir)
puts " Cloning repository into #{clonedir}"
git = Git.clone("#{entry['repo']}.git", Pathname.new(clonedir), branch: entry['ref'], depth: fetch_depth)
Expand Down
40 changes: 32 additions & 8 deletions _plugins/last_modified_at.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,51 @@
module Jekyll
class LastModifiedAt < Octopress::Hooks::Site
DATE_FORMAT = '%Y-%m-%d %H:%M:%S %z'
def pre_render(site)
if get_docs_url == "http://localhost:4000"
# Do not generate last_modified_at for local development
return

def current_last_modified_at(site, page)
if page.data.key?('last_modified_at')
return page.data['last_modified_at']
end
site.config['defaults'].map do |set|
if set['values'].key?('last_modified_at') && set['scope']['path'].include?(page.relative_path)
return set['values']['last_modified_at']
end
end.compact
nil
end

def pre_render(site)
beginning_time = Time.now
Jekyll.logger.info "Starting plugin last_modified_at.rb..."

git = Git.open(site.source)
site.pages.each do |page|
use_file_mtime = get_docs_url == "http://localhost:4000" && ENV['DOCS_ENFORCE_GIT_LOG_HISTORY'] == "0"
site.pages.sort!{|l,r| l.relative_path <=> r.relative_path }.each do |page|
next if page.relative_path == "redirect.html"
next unless File.extname(page.relative_path) == ".md" || File.extname(page.relative_path) == ".html"
unless page.data.key?('last_modified_at')
page.data['last_modified_at'] = current_last_modified_at(site, page)
set_mode = "frontmatter"
path_override = ""
if page.data['last_modified_at'].nil?
page_relative_path = page.relative_path
if page.data.key?('datafolder') && page.data.key?('datafile')
page_relative_path = File.join('_data', page.data['datafolder'], "#{page.data['datafile']}.yaml")
path_override = "\n override: #{page_relative_path}"
end
begin
page.data['last_modified_at'] = git.log.path(page.relative_path).first.date.strftime(DATE_FORMAT)
if use_file_mtime
# Use file's mtime for local development
page.data['last_modified_at'] = File.mtime(page_relative_path).strftime(DATE_FORMAT)
set_mode = "mtime"
else
page.data['last_modified_at'] = git.log.path(page_relative_path).first.date.strftime(DATE_FORMAT)
set_mode = "git"
end
rescue => e
# Ignored
end
end
puts" #{page.relative_path}\n last_modified_at: #{page.data['last_modified_at']}"
puts" #{page.relative_path}#{path_override}\n last_modified_at(#{set_mode}): #{page.data['last_modified_at']}"
end

end_time = Time.now
Expand Down
4 changes: 4 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ variable "DOCS_URL" {
variable "DOCS_SITE_DIR" {
default = "_site"
}
variable "DOCS_ENFORCE_GIT_LOG_HISTORY" {
default = "0"
}

target "_common" {
args = {
JEKYLL_ENV = JEKYLL_ENV
DOCS_URL = DOCS_URL
DOCS_ENFORCE_GIT_LOG_HISTORY = DOCS_ENFORCE_GIT_LOG_HISTORY
}
no-cache-filter = ["generate"]
}
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
args:
- JEKYLL_ENV
- DOCS_URL
- DOCS_ENFORCE_GIT_LOG_HISTORY
context: .
image: docs/docstage
ports:
Expand Down
5 changes: 2 additions & 3 deletions subscription/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ When you downgrade your Pro or Team plan, changes are applied at the end of your

### How do I downgrade from a Team plan to a Free Team plan?

Before you downgrade to a Free plan, ensure that your organization details are updated to reflect features available in the Free plan. For example, you may need to reduce the number of team members and convert any private repositories to public repositories. For information on what’s included in the Free plan, see the [billing](index.md#pricing-plans){:target="blank" rel="noopener" class=""} page.
Before you downgrade to a Free plan, ensure that your organization details are updated to reflect features available in the Free plan. For example, you may need to reduce the number of team members and convert any private repositories to public repositories. For information on what’s included in the Free plan, see the [billing](index.md){:target="blank" rel="noopener" class=""} page.

### How do I downgrade from Pro to a Free plan?

Expand Down Expand Up @@ -141,8 +141,7 @@ Team starts at $25 per month for the first five users and $7 per month for each
### How will the new pricing plan impact existing Docker Hub customers?

Legacy individual and organizational repository customers have until their January 2021 billing cycle to switch to the new pricing plans.
To view the status of your individual repository plan, see [the billing](https://
hub.docker.com/billing/plan/update){:target="blank" rel="noopener" class=""} page.
To view the status of your individual repository plan, see [the billing](https://hub.docker.com/billing/plan/update){:target="blank" rel="noopener" class=""} page.
To view the status of your organizational repository plan, see [Docker Hub Orgs](https://hub.docker.com/orgs){:target="blank" rel="noopener" class=""} page.

### What is the difference between the legacy repository plans and the newly announced plans?
Expand Down