diff --git a/.gitignore b/.gitignore index e01d57a176caf7751ccd467cc7615c236109ce42..f9d1c605a9c6d68ba93bd530d8de580b729ba42b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,9 @@ sidekiq.log build_dependencies /scripts/app/assets/javascripts/mathjax /scripts/vendor/assets/javascripts/mathjax + +nodejs.tar.gz +node_modules.tar.gz +redis-cli.tar.gz +yarn.tar.gz +bundle.tar.gz diff --git a/Dockerfile b/Dockerfile index 3174baa7db852d981df7c0a377d726af5b2272ea..61b721d0ab12f510db0b488cab5684335f73caca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG BASE_REGISTRY=registry1.dso.mil -ARG BASE_IMAGE=opensource/ruby/ruby27 -ARG BASE_TAG=2.7.2 +ARG BASE_IMAGE=ironbank/opensource/ruby/ruby27 +ARG BASE_TAG=2.7.3 FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG} USER 0 @@ -8,7 +8,8 @@ USER 0 # Install required libs. RUN dnf update -y && dnf install -y \ libpq-devel \ - && dnf clean all + && dnf clean all \ + && rm -rf /var/cache/dnf/ /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???* # Setup our environment. WORKDIR /app @@ -18,7 +19,6 @@ COPY bundle.tar.gz \ nodejs.tar.gz \ redis-cli.tar.gz \ yarn.tar.gz \ - mathjax.tar.gz \ ./ # Copy all dependencies to their correct locations. @@ -27,7 +27,6 @@ RUN tar xzf redis-cli.tar.gz && rm redis-cli.tar.gz && mv redis-cli /usr/local/b tar xzf node_modules.tar.gz && rm node_modules.tar.gz && \ tar xzf nodejs.tar.gz && rm nodejs.tar.gz && \ tar xzf yarn.tar.gz && rm yarn.tar.gz && \ - tar xzf mathjax.tar.gz && rm mathjax.tar.gz && mv mathjax vendor/assets/javascripts/ && \ chown -R 1001 . # Become the ruby user diff --git a/README.md b/README.md index 77204ff10c1033f20bf460d96d88540de37c63d8..be2126a1dd23afd46798fc15993b5249150759dc 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Install rbenv and get the right version of ruby (the version here may change, so version. ) - `brew install rbenv` -- `rbenv install 2.7.2` +- `rbenv install 2.7.3` Install our data stores: @@ -55,7 +55,7 @@ You will need a [Github access token](https://github.com/settings/tokens). Repla The token will need **Full control of private repositories** - `git clone git@github.com:Galvanize-IT/forge.git && cd forge` -- `rbenv local 2.7.2` +- `rbenv local 2.7.3` - `gem install bundler` - `bundle config --local GITHUB__COM YOUR_GENERATED_PERSONAL_ACCESS_TOKEN:x-oauth-basic` - `bundle` diff --git a/hardening_manifest.yaml b/hardening_manifest.yaml index 5bae7cbc3438ffa445555dc969e1d71dca26ca7c..2e7065eb6bfe86ef1d50a3e27792f63150adba51 100644 --- a/hardening_manifest.yaml +++ b/hardening_manifest.yaml @@ -8,13 +8,13 @@ name: "galvanize/galvanize/forge" # The most specific version should be the first tag and will be shown # on ironbank.dsop.io tags: -- "0.1.0" +- "0.1.1" - "latest" # Build args passed to Dockerfile ARGs args: BASE_IMAGE: "opensource/ruby/ruby27" - BASE_TAG: "2.7.2" + BASE_TAG: "2.7.3" # Docker image labels labels: @@ -23,7 +23,7 @@ labels: org.opencontainers.image.licenses: "proprietary" org.opencontainers.image.url: "https://www.galvanize.com" org.opencontainers.image.vendor: "Galvanize" - org.opencontainers.image.version: "0.1.0" + org.opencontainers.image.version: "0.1.1" mil.dso.ironbank.image.keywords: "learn,lms,galvanize,online,remote,school,learning" mil.dso.ironbank.image.type: "commercial" mil.dso.ironbank.product.name: "Learn" @@ -34,56 +34,47 @@ resources: type: s3 id: galvanize region: us-gov-west-1 - url: s3://learn-dependencies/forge/redis-cli.tar.gz + url: s3://learn-dependencies/forge/redis-cli-0.1.1.tar.gz filename: redis-cli.tar.gz validation: type: sha256 - value: 1f3fa5e26f253e1d541a9dc7a6b978f9a8f6f8dbbe85344a8323214ee78e107a + value: e5016c467f2faec481642eef5b17e07a01af66aaf5ea0f8d108f3c9478468e5c - auth: type: s3 id: galvanize region: us-gov-west-1 - url: s3://learn-dependencies/forge/node_modules.tar.gz + url: s3://learn-dependencies/forge/node_modules-0.1.1.tar.gz filename: node_modules.tar.gz validation: type: sha256 - value: 9989c33100c0bd1048140e2afc14d051fc5362e548af9f4854b4c8ac30695404 + value: c23244c8a0ab10ee254189632c816c9b686f9ad459b1b96eda10e39f03f34b31 - auth: type: s3 id: galvanize region: us-gov-west-1 - url: s3://learn-dependencies/forge/nodejs.tar.gz + url: s3://learn-dependencies/forge/nodejs-0.1.1.tar.gz filename: nodejs.tar.gz validation: type: sha256 - value: a477786fb93af03dc95aaf6f8641711a9a57e560e1937dbc4d349097b883b395 + value: e1423d62b88b03bdb60693811dc7fa26980e756c748d66790476aac00211b8c8 - auth: type: s3 id: galvanize region: us-gov-west-1 - url: s3://learn-dependencies/forge/yarn.tar.gz + url: s3://learn-dependencies/forge/yarn-0.1.1.tar.gz filename: yarn.tar.gz validation: type: sha256 - value: ed8ff853ada4b8b1358b4e98ece813897b053e5bbd80e5b80f535b10d3353780 + value: 87a3d3ab1eeced756b3c93e4a57b4fa84ea5aa4aa16ff5ee82748ec8e6ecf741 - auth: type: s3 id: galvanize region: us-gov-west-1 - url: s3://learn-dependencies/forge/bundle.tar.gz + url: s3://learn-dependencies/forge/bundle-0.1.1.tar.gz filename: bundle.tar.gz validation: type: sha256 - value: 7c82a0aa0bc1bf9992c7d272872db5b2fcbf9750e000beb37671f3039138be3b - - auth: - type: s3 - id: galvanize - region: us-gov-west-1 - url: s3://learn-dependencies/forge/mathjax.tar.gz - filename: mathjax.tar.gz - validation: - type: sha256 - value: 8eeb7fe05a133d48359c62d3f1b9cf8faf0b10e1bdc70eea4115bc13053da715 + value: 4c2fe96f4b1231cbe63521e9ab69cbbc10d66f276a4499269a8ee41e259af303 # List of project maintainers maintainers: diff --git a/scripts/.nvmrc b/scripts/.nvmrc index 512e38cbc055eca4d61c91c102e3e1fa7d785483..e81c02600c76f7b8199e338b785224c936069972 100644 --- a/scripts/.nvmrc +++ b/scripts/.nvmrc @@ -1 +1 @@ -14.16.0 \ No newline at end of file +14.17.0 \ No newline at end of file diff --git a/scripts/.ruby-version b/scripts/.ruby-version index 37c2961c2430f357166156e7ddf1c590eb8d4ce1..2c9b4ef42ecbc54d7c946c9ad26424b89d1f792d 100644 --- a/scripts/.ruby-version +++ b/scripts/.ruby-version @@ -1 +1 @@ -2.7.2 +2.7.3 diff --git a/scripts/Dockerfile.packages b/scripts/Dockerfile.packages index 9183f0c9dc4b77c56e3fe286728d0d3e677805f5..1167138e2ebcd3ab8288546a2e77773e8b0520ca 100644 --- a/scripts/Dockerfile.packages +++ b/scripts/Dockerfile.packages @@ -8,7 +8,6 @@ USER 0 ARG NODE_VERSION ARG YARN_VERSION ARG JQUERY_RAILS_VERSION -ARG MATH_JAX_VERSION # Install required libs. RUN dnf update -y && dnf install -y \ @@ -27,35 +26,23 @@ RUN dnf update -y && dnf install -y \ WORKDIR /app ADD . . -# Switch to the binary directory. -WORKDIR /app/bundles - -# Redis -RUN curl -L http://download.redis.io/redis-stable.tar.gz -o redis-stable.tar.gz -RUN tar xzf redis-stable.tar.gz -WORKDIR /app/bundles/redis-stable -RUN make redis-cli -WORKDIR /app/bundles/redis-stable/src -RUN tar czf redis-cli.tar.gz redis-cli -RUN mv redis-cli.tar.gz /app/ -WORKDIR /app/bundles - -# Node.js -RUN curl -L https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz -o node-v$NODE_VERSION-linux-x64.tar.gz -RUN tar xzf node-v$NODE_VERSION-linux-x64.tar.gz -RUN mv node-v$NODE_VERSION-linux-x64 /app/nodejs - -# Yarn -RUN curl -L https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz -o yarn-v$YARN_VERSION.tar.gz -RUN ls -la -RUN tar xzf yarn-v$YARN_VERSION.tar.gz -RUN mv yarn-v$YARN_VERSION /app/yarn - -# Switch back to app dir. -WORKDIR /app - -# Add write permissions. -RUN chown -R 1001 . +# Download Redis, Node.js, Yarn +RUN curl -L http://download.redis.io/redis-stable.tar.gz -o redis-stable.tar.gz \ + && tar xzf redis-stable.tar.gz \ + && cd /app/redis-stable \ + && make redis-cli \ + && cd /app/redis-stable/src \ + && tar czf redis-cli.tar.gz redis-cli \ + && mv redis-cli.tar.gz /app/ \ + && cd /app \ + && curl -L https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz -o node-v$NODE_VERSION-linux-x64.tar.gz \ + && tar xzf node-v$NODE_VERSION-linux-x64.tar.gz \ + && mv node-v$NODE_VERSION-linux-x64 /app/nodejs \ + && rm -rf /app/nodejs/lib/node_modules/npm \ + && curl -L https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz -o yarn-v$YARN_VERSION.tar.gz \ + && tar xzf yarn-v$YARN_VERSION.tar.gz \ + && mv yarn-v$YARN_VERSION /app/yarn \ + && chown -R 1001 . # Become the ruby user USER 1001 @@ -65,47 +52,32 @@ ENV NODE_HOME /app/nodejs ENV PATH /app/node_modules/.bin:$PATH ENV PATH /app/yarn/bin:$PATH ENV PATH /app/nodejs/bin:$PATH -RUN ln -s /app/nodejs/bin/node /app/nodejs/bin/nodejs -# Remove NPM and repackage node. -RUN rm -rf /app/nodejs/lib/node_modules/npm -RUN tar czf nodejs.tar.gz nodejs - -# Repackage yarn. -RUN tar czf yarn.tar.gz yarn - -# Precompile assets -RUN yarn install -RUN tar czf node_modules.tar.gz node_modules - -# Run bundle install. -RUN gem install bundler -RUN bundle config set --local without 'development:test' -RUN bundle install +# Create a sym link to node and repackage nodejs and Yarn. +# Run yarn install and package the node modules. +# Install bundler, set the config, install the gems. +RUN ln -s /app/nodejs/bin/node /app/nodejs/bin/nodejs \ + && tar czf nodejs.tar.gz nodejs \ + && tar czf yarn.tar.gz yarn \ + && yarn install \ + && tar czf node_modules.tar.gz node_modules \ + && gem install bundler \ + && bundle config set --local without 'development:test' \ + && bundle install # Switch back to root user. USER 0 -# Go to jquery-rails directory -WORKDIR /usr/local/bundle/gems/jquery-rails-$JQUERY_RAILS_VERSION/vendor/assets/javascripts -RUN ls -la -RUN rm jquery_ujs.js jquery.js jquery.min.js jquery.min.map jquery2.js jquery2.min.js jquery2.min.map - -# Package Rails Gems. -WORKDIR /usr/local -RUN tar czf bundle.tar.gz bundle -RUN cp bundle.tar.gz /app/ +# Go to jquery-rails directory and remove the old jquery files. +# Package the bundle directory. +RUN cd /usr/local/bundle/gems/jquery-rails-$JQUERY_RAILS_VERSION/vendor/assets/javascripts \ + && rm jquery_ujs.js jquery.js jquery.min.js jquery.min.map jquery2.js jquery2.min.js jquery2.min.map \ + && cd /usr/local \ + && tar czf bundle.tar.gz bundle \ + && cp bundle.tar.gz /app/ # Change back to app dir. WORKDIR /app -# Install MathJax. -RUN curl -L https://github.com/mathjax/MathJax/archive/${MATH_JAX_VERSION}.tar.gz -o mathjax.tar.gz -RUN tar xzf mathjax.tar.gz -RUN find MathJax-${MATH_JAX_VERSION}/unpacked/localization \ - -mindepth 1 -maxdepth 1 -type d ! -name "en" -exec rm -rf '{}' \; -RUN mv MathJax-${MATH_JAX_VERSION}/unpacked/ mathjax/ -RUN tar czf mathjax.tar.gz mathjax - # Set the entry point. CMD tail -f /dev/null diff --git a/scripts/Gemfile b/scripts/Gemfile index 75911a55f5584ccb015186d248bc6f108e982ac9..5c8f14bce00d4ce3d37d8941c4564b16288d90db 100644 --- a/scripts/Gemfile +++ b/scripts/Gemfile @@ -1,5 +1,5 @@ source "https://rubygems.org" -ruby "2.7.2" +ruby "2.7.3" git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") @@ -34,7 +34,7 @@ gem "uglifier" gem "haml" gem "jquery-rails" gem "react-rails" -gem "underscore-rails" +# gem "underscore-rails" gem "js-routes" gem "browser" # gem "apitome" diff --git a/scripts/Gemfile.lock b/scripts/Gemfile.lock index 90ed4310370deb51bd0586a6ddda6ade890c44a7..6b67c9c22df3985f50633226a510894b7a8d8951 100644 --- a/scripts/Gemfile.lock +++ b/scripts/Gemfile.lock @@ -16,60 +16,60 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + actioncable (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actionmailbox (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (>= 2.7.1) - actionmailer (6.1.3) - actionpack (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activesupport (= 6.1.3) + actionmailer (6.1.3.2) + actionpack (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activesupport (= 6.1.3.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.3) - actionview (= 6.1.3) - activesupport (= 6.1.3) + actionpack (6.1.3.2) + actionview (= 6.1.3.2) + activesupport (= 6.1.3.2) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.3) - actionpack (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + actiontext (6.1.3.2) + actionpack (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) nokogiri (>= 1.8.5) - actionview (6.1.3) - activesupport (= 6.1.3) + actionview (6.1.3.2) + activesupport (= 6.1.3.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.3) - activesupport (= 6.1.3) + activejob (6.1.3.2) + activesupport (= 6.1.3.2) globalid (>= 0.3.6) - activemodel (6.1.3) - activesupport (= 6.1.3) - activerecord (6.1.3) - activemodel (= 6.1.3) - activesupport (= 6.1.3) - activestorage (6.1.3) - actionpack (= 6.1.3) - activejob (= 6.1.3) - activerecord (= 6.1.3) - activesupport (= 6.1.3) - marcel (~> 0.3.1) - mimemagic (~> 0.3.2) - activesupport (6.1.3) + activemodel (6.1.3.2) + activesupport (= 6.1.3.2) + activerecord (6.1.3.2) + activemodel (= 6.1.3.2) + activesupport (= 6.1.3.2) + activestorage (6.1.3.2) + actionpack (= 6.1.3.2) + activejob (= 6.1.3.2) + activerecord (= 6.1.3.2) + activesupport (= 6.1.3.2) + marcel (~> 1.0.0) + mini_mime (~> 1.0.2) + activesupport (6.1.3.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -1162,7 +1162,7 @@ GEM commonmarker (0.21.2) ruby-enum (~> 0.5) concurrent-ruby (1.1.8) - connection_pool (2.2.3) + connection_pool (2.2.5) crack (0.4.5) rexml crass (1.0.6) @@ -1212,7 +1212,7 @@ GEM httparty (0.18.1) mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (1.8.9) + i18n (1.8.10) concurrent-ruby (~> 1.0) iniparse (1.5.0) jmespath (1.4.0) @@ -1233,29 +1233,27 @@ GEM listen (3.4.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.9.0) + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) + marcel (1.0.1) memory_profiler (1.0.0) method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2021.0212) - mimemagic (0.3.5) - mini_mime (1.0.2) - mini_portile2 (2.5.0) - minitest (5.14.3) + mini_mime (1.0.3) + mini_portile2 (2.5.1) + minitest (5.14.4) msgpack (1.4.2) multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mustache (1.1.1) - nio4r (2.5.5) - nokogiri (1.11.1) + nio4r (2.5.7) + nokogiri (1.11.3) mini_portile2 (~> 2.5.0) racc (~> 1.4) octokit (4.20.0) @@ -1266,7 +1264,7 @@ GEM iniparse (~> 1.4) pagy (3.11.0) parallel (1.20.1) - parser (3.0.0.0) + parser (3.0.1.1) ast (~> 2.4.1) pg (1.2.3) popper_js (1.16.0) @@ -1280,26 +1278,26 @@ GEM rack (2.2.3) rack-attack (6.5.0) rack (>= 1.0, < 3) - rack-mini-profiler (2.3.1) + rack-mini-profiler (2.3.2) rack (>= 1.2.0) rack-proxy (0.6.5) rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.1.3) - actioncable (= 6.1.3) - actionmailbox (= 6.1.3) - actionmailer (= 6.1.3) - actionpack (= 6.1.3) - actiontext (= 6.1.3) - actionview (= 6.1.3) - activejob (= 6.1.3) - activemodel (= 6.1.3) - activerecord (= 6.1.3) - activestorage (= 6.1.3) - activesupport (= 6.1.3) + rails (6.1.3.2) + actioncable (= 6.1.3.2) + actionmailbox (= 6.1.3.2) + actionmailer (= 6.1.3.2) + actionpack (= 6.1.3.2) + actiontext (= 6.1.3.2) + actionview (= 6.1.3.2) + activejob (= 6.1.3.2) + activemodel (= 6.1.3.2) + activerecord (= 6.1.3.2) + activestorage (= 6.1.3.2) + activesupport (= 6.1.3.2) bundler (>= 1.15.0) - railties (= 6.1.3) + railties (= 6.1.3.2) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) @@ -1310,9 +1308,9 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (6.1.3) - actionpack (= 6.1.3) - activesupport (= 6.1.3) + railties (6.1.3.2) + actionpack (= 6.1.3.2) + activesupport (= 6.1.3.2) method_source rake (>= 0.8.7) thor (~> 1.0) @@ -1329,8 +1327,8 @@ GEM tilt redcarpet (3.5.1) redis (4.2.5) - regexp_parser (2.0.3) - rexml (3.2.4) + regexp_parser (2.1.1) + rexml (3.2.5) rspec (3.10.0) rspec-core (~> 3.10.0) rspec-expectations (~> 3.10.0) @@ -1358,17 +1356,17 @@ GEM rspec (~> 3.0) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.10.0) + rubocop (1.14.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml - rubocop-ast (>= 1.2.0, < 2.0) + rubocop-ast (>= 1.5.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) + rubocop-ast (1.5.0) + parser (>= 3.0.1.1) ruby-enum (0.9.0) i18n ruby-progressbar (1.11.0) @@ -1395,7 +1393,7 @@ GEM semantic_range (2.3.1) shoulda-matchers (4.5.1) activesupport (>= 4.2.0) - sidekiq (6.1.3) + sidekiq (6.2.1) connection_pool (>= 2.2.2) rack (~> 2.0) redis (>= 4.2.0) @@ -1427,7 +1425,6 @@ GEM concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - underscore-rails (1.8.3) unicode-display_width (2.0.0) vcr (6.0.0) webmock (3.11.2) @@ -1510,14 +1507,13 @@ DEPENDENCIES ts_routes tzinfo-data uglifier - underscore-rails vcr webmock webpacker zip-zip RUBY VERSION - ruby 2.7.2p137 + ruby 2.7.3p183 BUNDLED WITH 2.1.4 diff --git a/scripts/README.md b/scripts/README.md index 20a35d9a340c9052770f05050b67709f77925a98..86e4cc39bb4c1870fc10e959af21531a7a4e7794 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -12,7 +12,7 @@ Install rbenv and get the right version of ruby (the version here may change, so version. ) - `brew install rbenv` -- `rbenv install 2.7.2` +- `rbenv install 2.7.3` Install our data stores: @@ -32,7 +32,7 @@ You will need a [Github access token](https://github.com/settings/tokens). Repla The token will need **Full control of private repositories** - `git clone git@github.com:Galvanize-IT/forge.git && cd forge` -- `rbenv local 2.7.2` +- `rbenv local 2.7.3` - `gem install bundler` - `bundle config --local GITHUB__COM YOUR_GENERATED_PERSONAL_ACCESS_TOKEN:x-oauth-basic` - `bundle` diff --git a/scripts/app/assets/stylesheets/components/_cohorts.scss b/scripts/app/assets/stylesheets/components/_cohorts.scss index 5694369242a119579fc53331dab5962534cb7728..a5609132960b85663f342cfdc2ca888a77262093 100644 --- a/scripts/app/assets/stylesheets/components/_cohorts.scss +++ b/scripts/app/assets/stylesheets/components/_cohorts.scss @@ -880,6 +880,7 @@ > tbody > .cohortsetuprow > td.action-cell .user-action .action-kebab { padding-top: 7px; height: 40px; + cursor: pointer; } > tbody > .cohortsetuprow > td.action-cell .user-action .action-menu { margin: 18px 48px 0 0; diff --git a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsLessonRow.tsx b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsLessonRow.tsx index a65fd6b5cdeeceebbe3e1495ac3e60f61b93b5a7..5736531dc2ac5a4019a83fba4241514388a25368 100644 --- a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsLessonRow.tsx +++ b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsLessonRow.tsx @@ -44,7 +44,10 @@ export default class CohortSubmissionsLessonRow extends React.Component { + this.setState({ showActionMenu: !this.state.showActionMenu }); + }, 300); } get actionMenu() { diff --git a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsPerformanceModal.tsx b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsPerformanceModal.tsx index 34965af0f67aea9e4c1c18b7ee867417698a24e8..f2af699fa5d358b067035dbb8f8224f905ecbc2d 100644 --- a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsPerformanceModal.tsx +++ b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsPerformanceModal.tsx @@ -43,8 +43,11 @@ export default class CohortSubmissionsPerformanceModal extends React.Component

{ + this.setState({showActionMenu: !this.state.showActionMenu}); + this.props.clearOutOpenManualPerformanceModal(); + }, 300); } scoreHandler(score: any) { diff --git a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsStandardRow.tsx b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsStandardRow.tsx index 98d54728f35a867543451626b39d2c3188f7cf19..9f087beec4756c7d30767963a9939b8d5384a3e3 100644 --- a/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsStandardRow.tsx +++ b/scripts/app/javascript/components/cohorts/cohort_submissions/CohortSubmissionsStandardRow.tsx @@ -37,7 +37,10 @@ export default class CohortSubmissionsStandardRow extends React.Component { + this.setState({showActionMenu: !this.state.showActionMenu}); + }, 300); } get actionMenu() { diff --git a/scripts/app/javascript/components/cohorts/settings/CohortBlockReleaseRow.tsx b/scripts/app/javascript/components/cohorts/settings/CohortBlockReleaseRow.tsx index fe0693dba800255407770514a996eb0b9ae92511..ba11d42251f0b27d1273956f485b198418c72e68 100644 --- a/scripts/app/javascript/components/cohorts/settings/CohortBlockReleaseRow.tsx +++ b/scripts/app/javascript/components/cohorts/settings/CohortBlockReleaseRow.tsx @@ -184,9 +184,11 @@ export default class CohortBlockReleaseRow extends React.Component } toggleActionMenu() { - if (this.state.cohortRelease.state == 'processing' || this.state.cohortRelease.state == 'pending') { return null; } - - this.setState({ showActionMenu: !this.state.showActionMenu }); + // TODO: REMOVE THIS SET TIMEOUT. + setTimeout(() => { + if (this.state.cohortRelease.state == 'processing' || this.state.cohortRelease.state == 'pending') { return null; } + this.setState({ showActionMenu: !this.state.showActionMenu }); + }, 300); } buildAutoUpdateSelect() { diff --git a/scripts/app/javascript/components/cohorts/settings/UserCohortKebab.tsx b/scripts/app/javascript/components/cohorts/settings/UserCohortKebab.tsx index 7db7964469c49913c3e102cb6d1140392aa64602..a45f5bb867369581029f7cc0fef252f76c27d16e 100644 --- a/scripts/app/javascript/components/cohorts/settings/UserCohortKebab.tsx +++ b/scripts/app/javascript/components/cohorts/settings/UserCohortKebab.tsx @@ -13,7 +13,7 @@ type State = { showActionMenu: boolean } -export default class UserKebab extends React.Component { +export default class UserCohortKebab extends React.Component { constructor(props: Props) { super(props) this.state = { @@ -22,7 +22,10 @@ export default class UserKebab extends React.Component { } toggleActionMenu = () => { - this.setState({showActionMenu: !this.state.showActionMenu}); + // TODO: REMOVE THIS SET TIMEOUT. + setTimeout(() => { + this.setState({showActionMenu: !this.state.showActionMenu}); + }, 300); } handleMenuOutsideClick = (e: any) => { diff --git a/scripts/app/javascript/components/cohorts/settings/UserKebab.tsx b/scripts/app/javascript/components/cohorts/settings/UserKebab.tsx index ed8769e383347b70bbf66d665333093ecba21578..83a2dc6c1bb9d5f110841ca9df748b4e08fed949 100644 --- a/scripts/app/javascript/components/cohorts/settings/UserKebab.tsx +++ b/scripts/app/javascript/components/cohorts/settings/UserKebab.tsx @@ -22,7 +22,10 @@ export default class UserKebab extends React.Component { } toggleActionMenu = () => { - this.setState({ showActionMenu: !this.state.showActionMenu }); + // TODO: REMOVE THIS SET TIMEOUT. + setTimeout(() => { + this.setState({ showActionMenu: !this.state.showActionMenu }); + }, 300); } handleMenuOutsideClick = (e: any) => { diff --git a/scripts/app/javascript/components/shared/Modal/Modal.tsx b/scripts/app/javascript/components/shared/Modal/Modal.tsx index 601ed74f6e3684b152b53c1af23743bd36007367..564e92df26d524c8696771b17e34efdcaccce402 100644 --- a/scripts/app/javascript/components/shared/Modal/Modal.tsx +++ b/scripts/app/javascript/components/shared/Modal/Modal.tsx @@ -18,13 +18,16 @@ export default class Modal extends React.Component { componentDidUpdate() { if (!this.props.shouldCloseOnOutsideClick) return; - if (this.props.visible) { - document.addEventListener('touchmove', this.handleOutsideClick, false); - document.addEventListener('click', this.handleOutsideClick, false); - } else if (!this.props.visible) { - document.removeEventListener('touchmove', this.handleOutsideClick, false); - document.removeEventListener('click', this.handleOutsideClick, false); - } + // TODO: REMOVE THIS SET TIMEOUT. + setTimeout(() => { + if (this.props.visible) { + document.addEventListener('touchmove', this.handleOutsideClick, false); + document.addEventListener('click', this.handleOutsideClick, false); + } else if (!this.props.visible) { + document.removeEventListener('touchmove', this.handleOutsideClick, false); + document.removeEventListener('click', this.handleOutsideClick, false); + } + }, 300); } handleOutsideClick = (e: any) => { diff --git a/scripts/app/jobs/slack_challenge_performance_job.rb b/scripts/app/jobs/slack_challenge_performance_job.rb index 8fd8b8a817a8ace900a59ec7f7930d781ca71ecd..b63b9ea5298329d161c60d9b60598824a31e6173 100644 --- a/scripts/app/jobs/slack_challenge_performance_job.rb +++ b/scripts/app/jobs/slack_challenge_performance_job.rb @@ -24,6 +24,6 @@ class SlackChallengePerformanceJob < SlackJob end def webhook_params - "T02DNK3PH/BAYH03V1S/dMw9H1C6cnxLYcaW0qB2hwDv" + "" end end diff --git a/scripts/app/jobs/slack_ds_prep_job.rb b/scripts/app/jobs/slack_ds_prep_job.rb index eb7861ef11b9e6c2cffcb4cc672bc95a4e63d4df..53ed5321d763931c2a0c1b9ba673cdbc863caf20 100644 --- a/scripts/app/jobs/slack_ds_prep_job.rb +++ b/scripts/app/jobs/slack_ds_prep_job.rb @@ -1,5 +1,5 @@ class SlackDSPrepJob < SlackJob def webhook_params - "T02DNK3PH/BHT5WTPST/dv9P8lku8WnMcbwo6Rfpck60" + "" end end diff --git a/scripts/app/jobs/slack_se_prep_job.rb b/scripts/app/jobs/slack_se_prep_job.rb index 61ee4c613848bbaff42b6d1c94f0fbc5e7ea6b86..f9ff7c866cc504508a47f715f2062efb17534fc2 100644 --- a/scripts/app/jobs/slack_se_prep_job.rb +++ b/scripts/app/jobs/slack_se_prep_job.rb @@ -1,5 +1,5 @@ class SlackSEPrepJob < SlackJob def webhook_params - "T02DNK3PH/BHHAHHNC9/UKHC5WbIa1kzLNAZP73JS4L8" + "" end end diff --git a/scripts/app/jobs/slack_student_job.rb b/scripts/app/jobs/slack_student_job.rb index 1510f0f81f7cd2595628f081f0f81680888e2393..4261bd1face345b89c8cade4a94309b6bcbf0c9c 100644 --- a/scripts/app/jobs/slack_student_job.rb +++ b/scripts/app/jobs/slack_student_job.rb @@ -1,5 +1,5 @@ class SlackStudentJob < SlackJob def webhook_params - "T1T555TL0/B655C4FD5/lsRWDnWv4i9OBolwsHfVgWci" + "" end end diff --git a/scripts/repackage.sh b/scripts/repackage.sh index d9cd9500ab91bff1ea7bacf16dc5fb5a2cec46c7..23fcd888cdd63afbdb02a17ff00ad050ec5954af 100755 --- a/scripts/repackage.sh +++ b/scripts/repackage.sh @@ -1,21 +1,22 @@ #!/bin/bash # Image Params. -BASE_REGISTRY=registry.il2.dso.mil -BASE_IMAGE=platform-one/devops/pipeline-templates/ironbank/ruby27 -BASE_TAG=2.7.2 +BASE_REGISTRY=registry1.dso.mil +BASE_IMAGE=ironbank/opensource/ruby/ruby27 +BASE_TAG=2.7.3 # Package Versions. -NODE_VERSION=14.16.0 -YARN_VERSION=1.22.5 +NODE_VERSION=14.17.0 +YARN_VERSION=1.22.10 JQUERY_RAILS_VERSION=4.4.0 -MATH_JAX_VERSION=2.7.4 # This is the profile name in your aws credentials file. DEPENDENCY_FOLDER=build_dependencies -AWS_PROFILE_NAME=revacomm -AWS_BUCKET_NAME=learn-dependencies/forge +AWS_PROFILE_NAME=rc-govcloud +AWS_BUCKET_URL=s3://learn-dependencies/forge AWS_REGION=us-gov-west-1 +VERSION_NUMBER=$(yq e '.tags[0]' ../hardening_manifest.yaml) +IMAGE_TAG=forge-tag echo "Clearing dependency folder." rm -rf $DEPENDENCY_FOLDER @@ -24,53 +25,82 @@ mkdir $DEPENDENCY_FOLDER echo "Clearing node_modules." rm -rf node_modules -echo "Clearing MathJax." -rm -rf vendor/assets/javascripts/mathjax - -echo "Building docker image." -IMAGE_ID=$(docker build --file Dockerfile.packages . -q \ +echo "Building docker image with tag: $IMAGE_TAG" +docker build -t $IMAGE_TAG \ + --file Dockerfile.packages . -q \ --build-arg BASE_REGISTRY=$BASE_REGISTRY \ --build-arg BASE_IMAGE=$BASE_IMAGE \ --build-arg BASE_TAG=$BASE_TAG \ --build-arg NODE_VERSION=$NODE_VERSION \ --build-arg YARN_VERSION=$YARN_VERSION \ - --build-arg JQUERY_RAILS_VERSION=$JQUERY_RAILS_VERSION \ - --build-arg MATH_JAX_VERSION=$MATH_JAX_VERSION) -echo "Image ID: ${IMAGE_ID}" + --build-arg JQUERY_RAILS_VERSION=$JQUERY_RAILS_VERSION echo "Starting docker container." -CONTAINER_ID=$(docker run -d $IMAGE_ID) -echo "Container ID: ${CONTAINER_ID}" +CONTAINER_ID=$(docker run -d $IMAGE_TAG) + +if [ -z "$CONTAINER_ID" ]; then + echo "[ERROR] - Failed to start the docker container. Exiting.." + exit +else + echo "Container ID: ${CONTAINER_ID}" +fi echo "Copying node modules and gems to the bundles directory." -docker cp $CONTAINER_ID:/app/node_modules.tar.gz $DEPENDENCY_FOLDER -docker cp $CONTAINER_ID:/app/nodejs.tar.gz $DEPENDENCY_FOLDER -docker cp $CONTAINER_ID:/app/yarn.tar.gz $DEPENDENCY_FOLDER -docker cp $CONTAINER_ID:/app/redis-cli.tar.gz $DEPENDENCY_FOLDER -docker cp $CONTAINER_ID:/app/bundle.tar.gz $DEPENDENCY_FOLDER -docker cp $CONTAINER_ID:/app/mathjax.tar.gz $DEPENDENCY_FOLDER +docker cp "$CONTAINER_ID:/app/redis-cli.tar.gz" "$DEPENDENCY_FOLDER/redis-cli-${VERSION_NUMBER}.tar.gz" || exit +docker cp "$CONTAINER_ID:/app/node_modules.tar.gz" "$DEPENDENCY_FOLDER/node_modules-${VERSION_NUMBER}.tar.gz" || exit +docker cp "$CONTAINER_ID:/app/nodejs.tar.gz" "$DEPENDENCY_FOLDER/nodejs-${VERSION_NUMBER}.tar.gz" || exit +docker cp "$CONTAINER_ID:/app/yarn.tar.gz" "$DEPENDENCY_FOLDER/yarn-${VERSION_NUMBER}.tar.gz" || exit +docker cp "$CONTAINER_ID:/app/bundle.tar.gz" "$DEPENDENCY_FOLDER/bundle-${VERSION_NUMBER}.tar.gz" || exit echo "Stopping the docker container." -docker stop $CONTAINER_ID +docker kill "$CONTAINER_ID" echo "Uploading all the build dependencies to AWS." -aws s3 sync $DEPENDENCY_FOLDER s3://$AWS_BUCKET_NAME --delete --profile $AWS_PROFILE_NAME --region $AWS_REGION - -echo "Checksums:" -cd $DEPENDENCY_FOLDER -sha256sum redis-cli.tar.gz -sha256sum node_modules.tar.gz -sha256sum nodejs.tar.gz -sha256sum yarn.tar.gz -sha256sum bundle.tar.gz -sha256sum mathjax.tar.gz -cd .. +aws s3 sync $DEPENDENCY_FOLDER $AWS_BUCKET_URL --profile $AWS_PROFILE_NAME --region $AWS_REGION || exit + +echo " Getting Checksums." +REDIS_CHECKSUM=$(sha256sum "$DEPENDENCY_FOLDER/redis-cli-${VERSION_NUMBER}.tar.gz" | awk '{ print $1 }') +NODE_MODULES_CHECKSUM=$(sha256sum "$DEPENDENCY_FOLDER/node_modules-${VERSION_NUMBER}.tar.gz" | awk '{ print $1 }') +NODEJS_CHECKSUM=$(sha256sum "$DEPENDENCY_FOLDER/nodejs-${VERSION_NUMBER}.tar.gz" | awk '{ print $1 }') +YARN_CHECKSUM=$(sha256sum "$DEPENDENCY_FOLDER/yarn-${VERSION_NUMBER}.tar.gz" | awk '{ print $1 }') +BUNDLE_CHECKSUM=$(sha256sum "$DEPENDENCY_FOLDER/bundle-${VERSION_NUMBER}.tar.gz" | awk '{ print $1 }') +echo "Redis CLI Checksum: ${REDIS_CHECKSUM}" +echo "Node Modules Checksum: ${NODE_MODULES_CHECKSUM}" +echo "NodeJS Checksum: ${NODEJS_CHECKSUM}" +echo "Yarn Checksum: ${YARN_CHECKSUM}" +echo "Bundle Checksum: ${BUNDLE_CHECKSUM}" + +echo "Updating the hardening_manifest.yaml file." + +REDIS_PREV_SHA=$(yq eval '.resources[] | select(.filename == "redis-cli.tar.gz").validation.value' ../hardening_manifest.yaml) +REDIS_PREV_URL=$(yq eval '.resources[] | select(.filename == "redis-cli.tar.gz").url' ../hardening_manifest.yaml) +sed -i '' -e "s|$REDIS_PREV_SHA|$REDIS_CHECKSUM|g" ../hardening_manifest.yaml +sed -i '' -e "s|$REDIS_PREV_URL|${AWS_BUCKET_URL}/redis-cli-${VERSION_NUMBER}.tar.gz|g" ../hardening_manifest.yaml + +NODE_MODULES_PREV_SHA=$(yq eval '.resources[] | select(.filename == "node_modules.tar.gz").validation.value' ../hardening_manifest.yaml) +NODE_MODULES_PREV_URL=$(yq eval '.resources[] | select(.filename == "node_modules.tar.gz").url' ../hardening_manifest.yaml) +sed -i '' -e "s|$NODE_MODULES_PREV_SHA|$NODE_MODULES_CHECKSUM|g" ../hardening_manifest.yaml +sed -i '' -e "s|$NODE_MODULES_PREV_URL|${AWS_BUCKET_URL}/node_modules-${VERSION_NUMBER}.tar.gz|g" ../hardening_manifest.yaml + +NODEJS_PREV_SHA=$(yq eval '.resources[] | select(.filename == "nodejs.tar.gz").validation.value' ../hardening_manifest.yaml) +NODEJS_PREV_URL=$(yq eval '.resources[] | select(.filename == "nodejs.tar.gz").url' ../hardening_manifest.yaml) +sed -i '' -e "s|$NODEJS_PREV_SHA|$NODEJS_CHECKSUM|g" ../hardening_manifest.yaml +sed -i '' -e "s|$NODEJS_PREV_URL|${AWS_BUCKET_URL}/nodejs-${VERSION_NUMBER}.tar.gz|g" ../hardening_manifest.yaml + +YARN_PREV_SHA=$(yq eval '.resources[] | select(.filename == "yarn.tar.gz").validation.value' ../hardening_manifest.yaml) +YARN_PREV_URL=$(yq eval '.resources[] | select(.filename == "yarn.tar.gz").url' ../hardening_manifest.yaml) +sed -i '' -e "s|$YARN_PREV_SHA|$YARN_CHECKSUM|g" ../hardening_manifest.yaml +sed -i '' -e "s|$YARN_PREV_URL|${AWS_BUCKET_URL}/yarn-${VERSION_NUMBER}.tar.gz|g" ../hardening_manifest.yaml + +BUNDLE_PREV_SHA=$(yq eval '.resources[] | select(.filename == "bundle.tar.gz").validation.value' ../hardening_manifest.yaml) +BUNDLE_PREV_URL=$(yq eval '.resources[] | select(.filename == "bundle.tar.gz").url' ../hardening_manifest.yaml) +sed -i '' -e "s|$BUNDLE_PREV_SHA|$BUNDLE_CHECKSUM|g" ../hardening_manifest.yaml +sed -i '' -e "s|$BUNDLE_PREV_URL|${AWS_BUCKET_URL}/bundle-${VERSION_NUMBER}.tar.gz|g" ../hardening_manifest.yaml echo "Removing dependency folder." rm -rf $DEPENDENCY_FOLDER echo "Reinstalling local packages." yarn install -./install_local_packages.sh echo "Done!" \ No newline at end of file diff --git a/scripts/spec/jobs/slack_ds_prep_job_spec.rb b/scripts/spec/jobs/slack_ds_prep_job_spec.rb index 234c9afd3edfea2c16138323034c294ec6226413..c1c6478c9fb49ed3925c016403c7a9984d5720fd 100644 --- a/scripts/spec/jobs/slack_ds_prep_job_spec.rb +++ b/scripts/spec/jobs/slack_ds_prep_job_spec.rb @@ -10,7 +10,7 @@ describe SlackDSPrepJob do parsed_body = JSON.parse(args[:body]) expect(parsed_body["text"]).to eq(message) - expect(url).to + expect(url).to eq("https://hooks.slack.com/services/") end SlackDSPrepJob.perform_now(message) diff --git a/scripts/spec/jobs/slack_se_prep_job_spec.rb b/scripts/spec/jobs/slack_se_prep_job_spec.rb index 8be0522dadc13515d3fc6ec92dcc8f1faf6cc73b..0fab759653f1cfbf41beca94f3a082c2f3970b79 100644 --- a/scripts/spec/jobs/slack_se_prep_job_spec.rb +++ b/scripts/spec/jobs/slack_se_prep_job_spec.rb @@ -10,7 +10,7 @@ describe SlackSEPrepJob do parsed_body = JSON.parse(args[:body]) expect(parsed_body["text"]).to eq(message) - expect(url).to + expect(url).to eq("https://hooks.slack.com/services/") end SlackSEPrepJob.perform_now(message) diff --git a/scripts/spec/jobs/slack_student_job_spec.rb b/scripts/spec/jobs/slack_student_job_spec.rb index 670ecbe763894e8724e9dbfe7aac7d9083d99f87..ed0e55e3629c4b0769a8cc4dc19b7a47f92311cc 100644 --- a/scripts/spec/jobs/slack_student_job_spec.rb +++ b/scripts/spec/jobs/slack_student_job_spec.rb @@ -12,7 +12,7 @@ describe SlackStudentJob do parsed_body = JSON.parse(args[:body]) expect(parsed_body["channel"]).to eq(username) expect(parsed_body["text"]).to eq(message) - expect(url).to + expect(url).to eq("https://hooks.slack.com/services/") end SlackStudentJob.perform_now(message, username) diff --git a/trufflehog-config.yaml b/trufflehog-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8c85423a461b09f4a01c9458357a964e77933e21 --- /dev/null +++ b/trufflehog-config.yaml @@ -0,0 +1,12 @@ +skip_strings: + scripts/spec/fixtures/vcr_cassettes/github-branch-success.yml: + - "38ace18a4d5584d1cc0ec17e5e904c888293596b" + scripts/spec/fixtures/vcr_cassettes/github-repo-success.yml: + - "0711a9a1293ab2b9b77cf6280c1836c231c9c8d5" + scripts/spec/presenters/block_presenter/for_cohort_releases_spec.rb: + - "4f48644e307f4664f0de878c93d4a0b02163ea2c" + Gemfile: + - "81cd1ec61544746ee71d03287dc9d23126fdcf27" + - "6d0fc6c3f2d2d7d06b9ad51d52f57430b7e438bc" +skip_paths: + - trufflehog-config.yaml