Skip to content

Commit

Permalink
Update builders to use ruby 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adfoster-r7 committed Nov 22, 2023
1 parent 13ac571 commit 6caf200
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 20 deletions.
67 changes: 61 additions & 6 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ jobs:
# The job checkout structure is:
# .
# ├── metasploit-omnibus
# └── metasploit-framework (Only if ARM builds)
# └── metasploit-framework (Only if ARM/Windows builds)
# For windows we additionally move metasploit-framework into the omnibus local cache
#
docker_arm:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -208,12 +209,10 @@ jobs:
# If required, change reported architecture in new program environment and set personality flags
if [ ! -z "${LINUX32}" ] ; then
echo 'setting linux32'
architecturePrefix='linux32'
/bin/bash -x -c "docker run --rm --volume $(pwd):$(pwd) --workdir $(pwd) --user jenkins ${DOCKER_IMAGE} linux32 /bin/bash -l -c 'cd metasploit-omnibus && ARCH=x86_64 make'"
else
echo 'no arch prefix supplied'
architecturePrefix=''
/bin/bash -x -c "docker run --rm --volume $(pwd):$(pwd) --workdir $(pwd) --user jenkins ${DOCKER_IMAGE} /bin/bash -l -c 'cd metasploit-omnibus && make'"
fi
/bin/bash -x -c "docker run --rm --volume $(pwd):$(pwd) --workdir $(pwd) --user jenkins ${DOCKER_IMAGE} ${architecturePrefix} /bin/bash -l -c 'cd metasploit-omnibus && make'"
env:
LINUX32: ${{ matrix.docker.linux32 }}

Expand All @@ -227,13 +226,14 @@ jobs:
os:
- macos-11
ruby:
- 2.6
- 3.0.6

name: ${{ matrix.os }}
steps:
- name: Checkout omnibus
uses: actions/checkout@v4
with:
submodules: true
path: metasploit-omnibus

- name: Setup Ruby
Expand All @@ -244,6 +244,7 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
cache-version: 4
working-directory: metasploit-omnibus

- name: Run omnibus
run: |
Expand All @@ -254,3 +255,57 @@ jobs:
cd metasploit-omnibus
make
windows:
runs-on: ${{ matrix.os }}
timeout-minutes: 180

strategy:
fail-fast: false
matrix:
os:
- windows-2019
ruby:
- 3.0.6

name: ${{ matrix.os }}
steps:
- name: Checkout omnibus
uses: actions/checkout@v4
with:
submodules: true
path: metasploit-omnibus

- name: Setup Ruby
env:
BUNDLE_FORCE_RUBY_PLATFORM: true
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: false
cache-version: 4
working-directory: metasploit-omnibus
# Github actions with Ruby requires Bundler 2.2.18+
# https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
bundler: 2.2.33

# Checkout framework
- name: Checkout metasploit-framework code
uses: actions/checkout@v4
with:
repository: rapid7/metasploit-framework
path: metasploit-framework

- name: Extract xz files
run: |
cd metasploit-omnibus
xz -d local/cache/*.xz
- name: Run omnibus
run: |
# mkdir -p metasploit-omnibus/local/cache/git_cache/c
# mv metasploit-framework/ metasploit-omnibus/local/cache/git_cache/c
# dir metasploit-omnibus/local/cache/git_cache/c
# dir metasploit-omnibus/local/cache/git_cache/c/metasploit-framework
cd metasploit-omnibus
make
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.5
3.0.6
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GEM
aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2)
byebug (11.1.3)
chef-cleanroom (1.0.4)
chef-cleanroom (1.0.5)
chef-config (16.16.13)
addressable
chef-utils (= 16.16.13)
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.PHONY: all
all: certs/ca-certificates.crt
export SSL_CERT_FILE=${PWD}/certs/ca-certificates.crt
# export SSL_CERT_FILE=${PWD}/certs/ca-certificates.crt

# Ensure consistent bundler versions
gem install bundler -v 2.2.3
Expand All @@ -11,8 +11,10 @@ all: certs/ca-certificates.crt
bundle install
bundle binstubs --all

gem install win32-process -v 0.9.0

# build the metasploit-framework package
bin/omnibus build metasploit-framework
ruby bin/omnibus build metasploit-framework

certs/ca-certificates.crt:
mkdir -p certs
Expand Down
4 changes: 2 additions & 2 deletions docker/centos6-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ RUN su jenkins -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable'

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"

# pre-load the omnibus dependencies
RUN su jenkins -c "/bin/bash -l -c 'cd ~/ && git clone https://github.com/rapid7/metasploit-omnibus.git && \
cd ~/metasploit-omnibus && bundle install && bundle binstubs --all && cd ~/ && rm -fr metasploit-omnibus'"
cd ~/metasploit-omnibus && bundle install && bundle binstubs --all && cd ~/ && rm -fr metasploit-omnibus'"
2 changes: 1 addition & 1 deletion docker/debian-aarch64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ RUN command curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
curl -L -sSL https://get.rvm.io | bash -s stable
RUN /bin/bash -l -c "rvm requirements"
RUN /bin/bash -l -c "rvm install 2.6.5"
RUN /bin/bash -l -c "rvm install 3.0.6"
RUN /bin/bash -l -c "gem install bundler -v 2.2.3 --no-document"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/debian-armv7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN command curl -sSL https://rvm.io/mpapis.asc | gpg --import - && \
command curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - && \
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable
RUN /bin/bash -l -c "rvm requirements"
RUN /bin/bash -l -c "rvm install 2.6.5"
RUN /bin/bash -l -c "rvm install 3.0.6"
RUN /bin/bash -l -c "gem install bundler -v 2.2.4 --no-document"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/fedora30-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RUN su jenkins -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable'

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"
# pre-load the omnibus dependencies
RUN su jenkins -c "/bin/bash -l -c 'cd ~/ && git clone https://github.com/rapid7/metasploit-omnibus.git && \
Expand Down
2 changes: 1 addition & 1 deletion docker/kali109-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN mkdir -p /tmp/updated_certs && \
rm -rf /tmp/updated_certs

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu1204-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN su jenkins -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable '

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu1204-x86/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN su jenkins -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable '

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "linux32 /bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "linux32 /bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "linux32 /bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion docker/ubuntu1804-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN su jenkins -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable'

RUN su jenkins -c "/bin/bash -l -c 'rvm requirements'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 2.6.5'"
RUN su jenkins -c "/bin/bash -l -c 'rvm install 3.0.6'"
RUN su jenkins -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"

# pre-load the omnibus dependencies
Expand Down
2 changes: 1 addition & 1 deletion packer/configure_ami.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ su $BUILD_USER -c 'command curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L -sSL https://raw.githubusercontent.com/rvm/rvm/1.29.12/binscripts/rvm-installer | bash -s stable'

su $BUILD_USER -c "/bin/bash -l -c 'rvm requirements'"
su $BUILD_USER -c "/bin/bash -l -c 'rvm install 2.6.5'"
su $BUILD_USER -c "/bin/bash -l -c 'rvm install 3.0.6'"
su $BUILD_USER -c "/bin/bash -l -c 'gem install bundler -v 2.2.3 --no-document'"
su $BUILD_USER -c "/bin/bash -l -c 'cd ~/ && git clone https://github.com/rapid7/metasploit-omnibus.git && \
cd ~/metasploit-omnibus && bundle install && bundle binstubs --all && cd ~/ && rm -fr metasploit-omnibus'"
Expand Down

0 comments on commit 6caf200

Please sign in to comment.