Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEB-6755: Gem updates #238

Merged
merged 9 commits into from
Jan 9, 2024
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
59 changes: 52 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
FROM ruby:3.2-alpine
LABEL [email protected]
ARG RUBY_ENV

LABEL com.github.actions.name="robles"
LABEL com.github.actions.author="Kodeco <[email protected]>"
LABEL com.github.actions.description="Content publication for kodeco.com"
LABEL com.github.actions.color="purple"
LABEL com.github.actions.icon="book"
FROM ruby:3.2-alpine AS builder
LABEL [email protected]

ARG APP_ROOT=/app/robles
ARG BUILD_PACKAGES="build-base git"
Expand Down Expand Up @@ -41,3 +37,52 @@ RUN bundle install --jobs 20 --retry 5

# Copy the main application.
COPY . ./

# Remove extra files
RUN rm -rf /usr/local/bundle/cache/*


##############################
# PACKAGE STAGE #
##############################
FROM ruby:3.2-alpine
LABEL [email protected]
LABEL com.github.actions.name="robles"
LABEL com.github.actions.author="Kodeco <[email protected]>"
LABEL com.github.actions.description="Content publication for kodeco.com"
LABEL com.github.actions.color="purple"
LABEL com.github.actions.icon="book"

ARG APP_ROOT=/app/robles
ARG RUBY_ENV=${RUBY_ENV:-production}

ENV RUBY_ENV=${RUBY_ENV}

ARG RUNTIME_PACKAGES="imagemagick git tzdata"
ARG TEST_AND_DEV_PACKAGES="bash build-base libsodium-dev"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need libsodium-dev here as we are already copying libsodium from builder below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure whether it might also need header files or something else that might be part of the package when building a new version of the gem? Since this was only for test and development I thought it could probably stay in.


# SYSLOG TO STDOUT
RUN \
touch /var/log/syslog && \
ln -sf /proc/1/fd/1 /var/log/syslog

# libsodium
COPY --from=builder /usr/lib/libsodium.so* /usr/lib/
# Copy the app from builder
COPY --from=builder $APP_ROOT $APP_ROOT
COPY --from=builder /usr/local/bundle /usr/local/bundle

# Set the working directory
WORKDIR $APP_ROOT

# For runtime
RUN apk update \
&& apk upgrade \
&& apk add --update --no-cache $RUNTIME_PACKAGES \
&& rm -rf /var/cache/apk/*

# Test and dev packages
RUN if [ "$RUBY_ENV" == "test" -o "$RUBY_ENV" == "development" ]; then \
apk add --update --no-cache $TEST_AND_DEV_PACKAGES \
&& rm -rf /var/cache/apk/*; \
fi
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ gem 'cli-ui', '~> 2'
gem 'thor', '~> 1.0', '>= 1.0.1'

# Markdown processing
gem 'commonmarker'
# >= 1 switches out the underlying library to one that does not support musl
# Currently, there are no plans to support it, so let's lock to < 1
gem 'commonmarker', '< 1'

# HTTP Client
gem 'faraday', '~> 2'
Expand Down
86 changes: 43 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ GIT
GEM
remote: https://rubygems.org/
specs:
activemodel (7.1.1)
activesupport (= 7.1.1)
activesupport (7.1.1)
activemodel (7.1.2)
activesupport (= 7.1.2)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand All @@ -26,44 +26,44 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.835.0)
aws-sdk-core (3.185.1)
aws-eventstream (~> 1, >= 1.0.2)
aws-eventstream (1.3.0)
aws-partitions (1.877.0)
aws-sdk-core (3.190.1)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.72.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-sdk-kms (1.76.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-s3 (1.142.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
backport (1.2.0)
base64 (0.1.1)
benchmark (0.2.1)
bigdecimal (3.1.4)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.5)
cli-ui (2.2.3)
coderay (1.1.3)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
daemons (1.4.1)
diff-lcs (1.5.0)
drb (2.1.1)
drb (2.2.0)
ruby2_keywords
e2mmap (0.1.0)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
faraday (2.7.11)
faraday (2.8.1)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
Expand All @@ -77,7 +77,7 @@ GEM
websocket-driver (>= 0.6, < 0.8)
ffi (1.16.3)
formatador (1.1.0)
git (1.18.0)
git (1.19.0)
addressable (~> 2.8)
rchardet (~> 1.8)
google-protobuf (3.22.0)
Expand All @@ -101,7 +101,7 @@ GEM
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.6)
jmespath (1.6.2)
json (2.6.3)
json (2.7.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
Expand All @@ -110,17 +110,17 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lumberjack (1.2.9)
lumberjack (1.2.10)
method_source (1.0.0)
mini_magick (4.12.0)
mini_portile2 (2.8.4)
mini_portile2 (2.8.5)
minitest (5.20.0)
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mutex_m (0.1.2)
mutex_m (0.2.0)
nenv (0.3.0)
nokogiri (1.15.4)
nokogiri (1.16.0)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
notiffany (0.1.3)
Expand All @@ -129,48 +129,48 @@ GEM
octokit (7.2.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.23.0)
parser (3.2.2.4)
parallel (1.24.0)
parser (3.3.0.2)
ast (~> 2.4.1)
racc
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.3)
racc (1.7.1)
public_suffix (5.0.4)
racc (1.7.3)
rack (2.2.8)
rack-livereload (0.5.1)
rack
rack-protection (3.1.0)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rbnacl (7.1.1)
ffi
rbs (2.8.4)
rchardet (1.8.0)
regexp_parser (2.8.2)
regexp_parser (2.9.0)
reverse_markdown (2.1.1)
nokogiri
rexml (3.2.6)
rubocop (1.57.1)
base64 (~> 0.1.1)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand All @@ -181,13 +181,13 @@ GEM
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
shellany (0.0.1)
sinatra (3.1.0)
sinatra (3.2.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
rack-protection (= 3.2.0)
tilt (~> 2.0)
slack-notifier (2.4.0)
solargraph (0.49.0)
solargraph (0.50.0)
backport (~> 1.2)
benchmark
bundler (~> 2.0)
Expand All @@ -207,7 +207,7 @@ GEM
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.2.2)
thor (1.3.0)
tilt (2.3.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand All @@ -227,7 +227,7 @@ DEPENDENCIES
activesupport (< 7.2)
aws-sdk-s3 (~> 1.64)
cli-ui (~> 2)
commonmarker
commonmarker (< 1)
concurrent-ruby (~> 1.1)
faraday (~> 2)
faraday-retry
Expand All @@ -253,4 +253,4 @@ DEPENDENCIES
zeitwerk (~> 2.3)

BUNDLED WITH
2.4.20
2.5.4
14 changes: 0 additions & 14 deletions app/commands/content_module_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ def slides
snapshotter.generate
end


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works?
I guess I had reviewed the module text/video content UI using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should work...

desc 'serve', 'starts local preview server'
option :dev, type: :boolean, desc: 'Run in development mode (watch robles files, not module files)'
def serve
fork do
if options[:dev]
Guard.start(no_interactions: true)
else
Guard.start(guardfile_contents: content_module_guardfile, watchdir: './', no_interactions: true)
end
end
RoblesContentModuleServer.run!
end

desc 'secrets [REPO]', 'configures a module repo with the necessary secrets'
long_desc <<-LONGDESC
`robles module secrets [REPO]` will upload the secrets requires to run robles on a
Expand Down
6 changes: 3 additions & 3 deletions app/commands/video_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class VideoCli < Thor
option :'release-file', type: :string, desc: 'Location of the release.yaml file'
option :local, type: :boolean
def render
video_course = runner.render_video_course(release_file: options['release_file'], local: options['local'])
runner.render_video_course(release_file: options['release_file'], local: options['local'])
end

desc 'serve', 'starts local preview server'
Expand Down Expand Up @@ -39,8 +39,8 @@ def upload

desc 'lint [RELEASE_FILE]', 'runs a selection of linters on the video course'
option :'release-file', type: :string, desc: 'Location of the release.yaml file'
method_option 'without-version': :boolean, aliases: '-e', default: false, desc: 'Run linting without git branch naming check'
method_option silent: :boolean, aliases: '-s', default: false, desc: 'Hide all output'
method_option :'without-version', type: :boolean, aliases: '-e', default: false, desc: 'Run linting without git branch naming check'
method_option :silent, type: :boolean, aliases: '-s', default: false, desc: 'Hide all output'
def lint
output = runner.lint_video_course(release_file: options['publish_file'], options:)
exit 1 unless output.validated || ENVIRONMENT == 'staging'
Expand Down
2 changes: 1 addition & 1 deletion app/lib/linting/book_linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def book
parser.parse
end
rescue Parser::Error => e
line_number = (e.message.match(/at line (\d+)/)&.captures&.first&.to_i || 0) + 1
line_number = e.message.match(/at line (\d+)/)&.captures&.first.to_i + 1
annotations.push(
Annotation.new(
absolute_path: e.file,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/linting/content_module_linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def content_module
parser.parse
end
rescue Parser::Error => e
line_number = (e.message.match(/at line (\d+)/)&.captures&.first&.to_i || 0) + 1
line_number = e.message.match(/at line (\d+)/)&.captures&.first.to_i + 1
annotations.push(
Annotation.new(
absolute_path: e.file,
Expand Down
15 changes: 8 additions & 7 deletions app/lib/linting/metadata/captions_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ def video_course_captions
def module_captions
caption_files = ModuleFile.new(file:, attributes:).file_path_list
caption_files.map do |file|
captions_file = if yaml?(file)
load_yaml(File.read(file)).deep_symbolize_keys[:captions_file]
else
@markdown_metadata = nil
@path = file
markdown_metadata[:captions_file]
end
captions_file =
if yaml?(file)
load_yaml(File.read(file)).deep_symbolize_keys[:captions_file]
else
@markdown_metadata = nil
@path = file
markdown_metadata[:captions_file]
end
next unless captions_file.present?

[captions_file, file]
Expand Down
2 changes: 1 addition & 1 deletion app/lib/linting/vend_linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def load_file
parser.parse
end
rescue Parser::Error => e
line_number = (e.message.match(/at line (\d+)/)&.captures&.first&.to_i || 0) + 1
line_number = e.message.match(/at line (\d+)/)&.captures&.first.to_i + 1
@annotations.push(
Annotation.new(
absolute_path: e.file,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/linting/video_course_linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def video_course
parser.parse
end
rescue Parser::Error => e
line_number = (e.message.match(/at line (\d+)/)&.captures&.first&.to_i || 0) + 1
line_number = e.message.match(/at line (\d+)/)&.captures&.first.to_i + 1
annotations.push(
Annotation.new(
absolute_path: e.file,
Expand Down
Loading