Skip to content

Commit

Permalink
Merge branch 'main' into jamiemagee/sentry-ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee authored Jan 22, 2024
2 parents b1b9dd1 + fbd2204 commit 4ed2b1a
Show file tree
Hide file tree
Showing 39 changed files with 365 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/ci-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ common:
composer:
- *shared
- 'composer/**'
devcontainers:
- *shared
- 'devcontainers/**'
docker:
- *shared
- 'docker/**'
Expand Down
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- changed-files:
- any-glob-to-any-file: composer/**

"L: devcontainers":
- changed-files:
- any-glob-to-any-file: devcontainers/**

"L: docker":
- changed-files:
- any-glob-to-any-file: docker/**
Expand Down
3 changes: 3 additions & 0 deletions .github/smoke-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ cargo:
composer:
- *common
- 'composer/**'
devcontainers:
- *common
- 'devcontainers/**'
docker:
- *common
- 'docker/**'
Expand Down
5 changes: 5 additions & 0 deletions .github/smoke-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
"test": "composer",
"ecosystem": "composer"
},
{
"core": "devcontainers",
"test": "devcontainers",
"ecosystem": "devcontainers"
},
{
"core": "docker",
"test": "docker",
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
- { path: python, name: python, ecosystem: pip }
- { path: python, name: python_slow, ecosystem: pip }
- { path: swift, name: swift, ecosystem: swift }
- { path: devcontainers, name: devcontainers, ecosystem: devcontainers }
- { path: terraform, name: terraform, ecosystem: terraform }

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/images-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ jobs:
- { name: pub, ecosystem: pub }
- { name: python, ecosystem: pip }
- { name: swift, ecosystem: swift }
- { name: devcontainers, ecosystem: devcontainers }
- { name: terraform, ecosystem: terraform }
permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/images-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
- { name: pub, ecosystem: pub }
- { name: python, ecosystem: pip }
- { name: swift, ecosystem: swift }
- { name: devcontainers, ecosystem: devcontainers }
- { name: terraform, ecosystem: terraform }
env:
COMMIT_SHA: ${{ github.sha }}
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.updater-core
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ COPY --chown=dependabot:dependabot common/lib/dependabot.rb common/lib/dependabo
COPY --chown=dependabot:dependabot bundler/.bundle bundler/dependabot-bundler.gemspec bundler/
COPY --chown=dependabot:dependabot cargo/.bundle cargo/dependabot-cargo.gemspec cargo/
COPY --chown=dependabot:dependabot composer/.bundle composer/dependabot-composer.gemspec composer/
COPY --chown=dependabot:dependabot devcontainers/.bundle devcontainers/dependabot-devcontainers.gemspec devcontainers/
COPY --chown=dependabot:dependabot docker/.bundle docker/dependabot-docker.gemspec docker/
COPY --chown=dependabot:dependabot elm/.bundle elm/dependabot-elm.gemspec elm/
COPY --chown=dependabot:dependabot git_submodules/.bundle git_submodules/dependabot-git_submodules.gemspec git_submodules/
Expand All @@ -99,7 +100,7 @@ COPY --chown=dependabot:dependabot swift/.bundle swift/dependabot-swift.gemspec
COPY --chown=dependabot:dependabot terraform/.bundle terraform/dependabot-terraform.gemspec terraform/

# prevent having all the source in every ecosystem image
RUN for ecosystem in git_submodules terraform github_actions hex elm docker nuget maven gradle cargo composer go_modules python pub npm_and_yarn bundler swift; do \
RUN for ecosystem in git_submodules terraform github_actions hex elm docker nuget maven gradle cargo composer go_modules python pub npm_and_yarn bundler swift devcontainers; do \
mkdir -p $ecosystem/lib/dependabot; \
touch $ecosystem/lib/dependabot/$ecosystem.rb; \
done
Expand Down
37 changes: 19 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@

source "https://rubygems.org"

gemspec path: "bundler"
gemspec path: "cargo"
gemspec path: "common"
gemspec path: "composer"
gemspec path: "docker"
gemspec path: "elm"
gemspec path: "github_actions"
gemspec path: "git_submodules"
gemspec path: "go_modules"
gemspec path: "gradle"
gemspec path: "hex"
gemspec path: "maven"
gemspec path: "npm_and_yarn"
gemspec path: "nuget"
gemspec path: "pub"
gemspec path: "python"
gemspec path: "swift"
gemspec path: "terraform"
gem "dependabot-bundler", path: "bundler"
gem "dependabot-cargo", path: "cargo"
gem "dependabot-common", path: "common"
gem "dependabot-composer", path: "composer"
gem "dependabot-devcontainers", path: "devcontainers"
gem "dependabot-docker", path: "docker"
gem "dependabot-elm", path: "elm"
gem "dependabot-github_actions", path: "github_actions"
gem "dependabot-git_submodules", path: "git_submodules"
gem "dependabot-go_modules", path: "go_modules"
gem "dependabot-gradle", path: "gradle"
gem "dependabot-hex", path: "hex"
gem "dependabot-maven", path: "maven"
gem "dependabot-npm_and_yarn", path: "npm_and_yarn"
gem "dependabot-nuget", path: "nuget"
gem "dependabot-pub", path: "pub"
gem "dependabot-python", path: "python"
gem "dependabot-swift", path: "swift"
gem "dependabot-terraform", path: "terraform"

# Sorbet
gem "sorbet", "0.5.11178", group: :development
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ PATH
dependabot-composer (0.241.0)
dependabot-common (= 0.241.0)

PATH
remote: devcontainers
specs:
dependabot-devcontainers (0.241.0)
dependabot-common (= 0.241.0)

PATH
remote: docker
specs:
Expand Down Expand Up @@ -306,6 +312,7 @@ DEPENDENCIES
dependabot-cargo!
dependabot-common!
dependabot-composer!
dependabot-devcontainers!
dependabot-docker!
dependabot-elm!
dependabot-git_submodules!
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ GEMSPECS = %w(
pub/dependabot-pub.gemspec
omnibus/dependabot-omnibus.gemspec
swift/dependabot-swift.gemspec
devcontainers/dependabot-devcontainers.gemspec
).freeze

def run_command(command)
Expand Down
5 changes: 5 additions & 0 deletions bin/docker-dev-shell
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ docker run --rm -ti \
-v "$(pwd)/composer/lib:$CODE_DIR/composer/lib" \
-v "$(pwd)/composer/script:$CODE_DIR/composer/script" \
-v "$(pwd)/composer/spec:$CODE_DIR/composer/spec" \
-v "$(pwd)/devcontainers/.rubocop.yml:$CODE_DIR/devcontainers/.rubocop.yml" \
-v "$(pwd)/devcontainers/dependabot-devcontainers.gemspec:$CODE_DIR/devcontainers/dependabot-devcontainers.gemspec" \
-v "$(pwd)/devcontainers/lib:$CODE_DIR/devcontainers/lib" \
-v "$(pwd)/devcontainers/script:$CODE_DIR/devcontainers/script" \
-v "$(pwd)/devcontainers/spec:$CODE_DIR/devcontainers/spec" \
-v "$(pwd)/docker/.rubocop.yml:$CODE_DIR/docker/.rubocop.yml" \
-v "$(pwd)/docker/dependabot-docker.gemspec:$CODE_DIR/docker/dependabot-docker.gemspec" \
-v "$(pwd)/docker/lib:$CODE_DIR/docker/lib" \
Expand Down
3 changes: 3 additions & 0 deletions bin/dry-run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
# - terraform
# - pub
# - swift
# - devcontainers

# rubocop:disable Style/GlobalVars

Expand All @@ -52,6 +53,7 @@
$LOAD_PATH << "./cargo/lib"
$LOAD_PATH << "./common/lib"
$LOAD_PATH << "./composer/lib"
$LOAD_PATH << "./devcontainers/lib"
$LOAD_PATH << "./docker/lib"
$LOAD_PATH << "./elm/lib"
$LOAD_PATH << "./git_submodules/lib"
Expand Down Expand Up @@ -95,6 +97,7 @@
require "dependabot/bundler"
require "dependabot/cargo"
require "dependabot/composer"
require "dependabot/devcontainers"
require "dependabot/docker"
require "dependabot/elm"
require "dependabot/git_submodules"
Expand Down
1 change: 1 addition & 0 deletions common/lib/dependabot/config/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def self.parse(config)
"bundler" => "bundler",
"cargo" => "cargo",
"composer" => "composer",
"devcontainer" => "devcontainers",
"docker" => "docker",
"elm" => "elm",
"github-actions" => "github_actions",
Expand Down
1 change: 1 addition & 0 deletions devcontainers/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BUNDLE_GEMFILE: "../dependabot-updater/Gemfile"
5 changes: 5 additions & 0 deletions devcontainers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.bundle/
!.bundle/config
/.env
/tmp
/dependabot-*.gem
1 change: 1 addition & 0 deletions devcontainers/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
inherit_from: ../.rubocop.yml
38 changes: 38 additions & 0 deletions devcontainers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ghcr.io/dependabot/dependabot-updater-core
ARG TARGETARCH

# OS dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
make \
ca-certificates \
gnupg \
build-essential \
curl \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& NODE_MAJOR=18 \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list

RUN apt-get update -y \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*

RUN npm install -g @devcontainers/cli

USER dependabot

# Needed because tools like dependabot/cli will proxy/MITM the traffic
# to the registry with a cert that (without this change) is not known
# to the dev container process. See:
# * https://github.com/microsoft/vscode-remote-release/issues/6092
# * https://github.com/devcontainers/cli/blob/2d24543380dfc4d54e76b582536b52226af133c8/src/spec-utils/httpRequest.ts#L130-L162
# * https://github.com/devcontainers/cli/pull/559
ENV NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt

# Sanity check
RUN devcontainer --version

COPY --chown=dependabot:dependabot devcontainers $DEPENDABOT_HOME/devcontainers
COPY --chown=dependabot:dependabot common $DEPENDABOT_HOME/common
COPY --chown=dependabot:dependabot updater $DEPENDABOT_HOME/dependabot-updater
18 changes: 18 additions & 0 deletions devcontainers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## `dependabot-devcontainers`

Dev Containers support for [`dependabot-core`][core-repo].

### Running locally

1. Start a development shell

```
$ bin/docker-dev-shell devcontainers
```

2. Run tests
```
[dependabot-core-dev] ~ $ cd devcontainers && rspec
```

[core-repo]: https://github.com/dependabot/dependabot-core
33 changes: 33 additions & 0 deletions devcontainers/dependabot-devcontainers.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# frozen_string_literal: true

Gem::Specification.new do |spec|
common_gemspec =
Bundler.load_gemspec_uncached("../common/dependabot-common.gemspec")

spec.name = "dependabot-devcontainers"
spec.summary = "Provides Dependabot support for Dev Containers"
spec.description = "Dependabot-Devcontainers provides support for managing dev container versioning via Dependabot."

spec.author = common_gemspec.author
spec.email = common_gemspec.email
spec.homepage = common_gemspec.homepage
spec.license = common_gemspec.license

spec.metadata = {
"bug_tracker_uri" => common_gemspec.metadata["bug_tracker_uri"],
"changelog_uri" => common_gemspec.metadata["changelog_uri"]
}

spec.version = common_gemspec.version
spec.required_ruby_version = common_gemspec.required_ruby_version
spec.required_rubygems_version = common_gemspec.required_ruby_version

spec.require_path = "lib"
spec.files = Dir["lib/**/*"]

spec.add_dependency "dependabot-common", Dependabot::VERSION

common_gemspec.development_dependencies.each do |dep|
spec.add_development_dependency dep.name, *dep.requirement.as_list
end
end
23 changes: 23 additions & 0 deletions devcontainers/lib/dependabot/devcontainers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# typed: strong
# frozen_string_literal: true

# These all need to be required so the various classes can be registered in a
# lookup table of package manager names to concrete classes.
require "dependabot/devcontainers/file_fetcher"
require "dependabot/devcontainers/file_parser"
require "dependabot/devcontainers/update_checker"
require "dependabot/devcontainers/file_updater"
require "dependabot/devcontainers/metadata_finder"
require "dependabot/devcontainers/requirement"
require "dependabot/devcontainers/version"

require "dependabot/pull_request_creator/labeler"
Dependabot::PullRequestCreator::Labeler
.register_label_details("devcontainers", name: "devcontainers_package_manager", colour: "2753E3")

require "dependabot/dependency"
Dependabot::Dependency
.register_production_check("devcontainers", ->(_) { true })

require "dependabot/utils"
Dependabot::Utils.register_always_clone("devcontainers")
14 changes: 14 additions & 0 deletions devcontainers/lib/dependabot/devcontainers/file_fetcher.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# typed: strong
# frozen_string_literal: true

require "dependabot/file_fetchers"
require "dependabot/file_fetchers/base"

module Dependabot
module Devcontainers
class FileFetcher < Dependabot::FileFetchers::Base
end
end
end

Dependabot::FileFetchers.register("devcontainers", Dependabot::Devcontainers::FileFetcher)
21 changes: 21 additions & 0 deletions devcontainers/lib/dependabot/devcontainers/file_parser.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# typed: true
# frozen_string_literal: true

require "dependabot/file_parsers"
require "dependabot/file_parsers/base"

module Dependabot
module Devcontainers
class FileParser < Dependabot::FileParsers::Base
def parse
[]
end

private

def check_required_files; end
end
end
end

Dependabot::FileParsers.register("devcontainers", Dependabot::Devcontainers::FileParser)
14 changes: 14 additions & 0 deletions devcontainers/lib/dependabot/devcontainers/file_updater.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# typed: strong
# frozen_string_literal: true

require "dependabot/file_updaters"
require "dependabot/file_updaters/base"

module Dependabot
module Devcontainers
class FileUpdater < Dependabot::FileUpdaters::Base
end
end
end

Dependabot::FileUpdaters.register("devcontainers", Dependabot::Devcontainers::FileUpdater)
Loading

0 comments on commit 4ed2b1a

Please sign in to comment.