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

Update Ruby version to 3.0.6 (latest of 3.0 series) #19603

Closed
wants to merge 4 commits into from

Conversation

heliocola
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Ruby update

Description

In preparation to try out Ruby 3.1.2 with YJIT, this PR udpate to latest version of the Ruby 3.0 series.
The main goal of this PR is to update to the latest 3.0 series and create an issue to discuss an strategy and benchmark for Ruby 3.1.2 with and without YJIT.

Related Tickets & Documents

This PR replaces #19523

  • Related Issue #
  • Closes #

QA Instructions, Screenshots, Recordings

No extra QA would be necessary, but let CI run would be ideal.

UI accessibility checklist

None

For more info, check out the
Forem Accessibility Docs.

Added/updated tests?

  • No, and this is why: no extra tests needed.

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

@heliocola heliocola requested review from a team as code owners June 12, 2023 03:30
@heliocola heliocola requested review from jaw6 and dukegreene and removed request for a team June 12, 2023 03:30
@github-actions
Copy link
Contributor

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

.env_sample Outdated
@@ -1,7 +1,7 @@
# Development options

# App core values
APP_DOMAIN="localhost:3000"
APP_DOMAIN="forem.test"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

On GH Actions, some tests are still failing with invalid domain.

1st Try error in ./spec/system/feedback_message_spec.rb:13:
invalid domain: ".localhost:3000"

RSpec::Retry: 2nd try ./spec/system/feedback_message_spec.rb:13

2nd Try error in ./spec/system/feedback_message_spec.rb:13:
invalid domain: ".localhost:3000"
RSpec::Retry: 3rd try ./spec/system/feedback_message_spec.rb:13

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maestromac , @klardotsh : I just found in bin/setup that .env_sample is used as base for Dev/Local environment.

  unless File.exist?(".env")
    FileUtils.cp ".env_sample", ".env"
  end

So, I need to find a different solution for test environment.
I can simply have a .env.test with a different APP_CONFIG or change environments/test.rb to not consider this.

I will do some more digging on this tomorrow.
If you have a preferred way to go, please let me know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @heliocola — I'm not sure about this change (I'll defer to @maestromac and @klardotsh there) but the Ruby upgrade looks good without it, and this change seems unrelated. I'd suggest maybe moving this change to a separate PR, that way the Ruby upgrade can proceed on its own?

Copy link
Contributor

Choose a reason for hiding this comment

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

This change is required because GCI does not allow 3000 to be part of cookie domain.

And if I am following this correctly, doesn't this mean the development cookie domain also needs to be updated? I can't see any error when I try this out locally though

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 splitting the .env for testing is the best way to go.
I will push that change and sync up this PR.

@maestromac : for development environment, this variable isn't used for cookie the way it is for Testing and Production.
Check these references: https://github.com/forem/forem/blob/main/config/initializers/middlewares.rb#L4C89-L4C89
But it still doesn't explain how this fails in the testing environment.

I will split the env file, and do some digging if I remember how the test env is affected.

@heliocola
Copy link
Contributor Author

Forem Team: I reviewed all the CI failures and it looks like the issues with invalid domain have been fixed.
In fact, the change in .env_sample to not use localhost:3000 is required.
References:

The current CI failures are grouped as follow:

  1. Knapsack pro connection failures (both rspec and cypress)
  2. And quay.io/forem/ruby:3.0.6: not found

My main goal with this PR is to be able to get to latest version of Ruby 3.0 series and from there update to Ruby 3.1.2 (and do some benchmarking with YJIT).
So, let me know if there is anything else needed to merge this.

And at last but not least: there is an issue with cookies domain, as noted by @gareth here: #19523 (comment)

That can probably be a separate issue to make Forem to conform with RFC 6265.

Despite the fact Rails is changing its behavior (ref: rails/rails#48036 and thank you @gareth ), Forem repo does specifically adds leading dot to the domain in a few places, so that should be treated separately.
References:

So that deserves its own issue, pr, and review process.

@mirie
Copy link
Contributor

mirie commented Jun 13, 2023

@maestromac flagging you on this one

@klardotsh
Copy link
Contributor

klardotsh commented Jun 13, 2023

Upgrading the quay.io/forem/ruby image is non-trivial unfortunately, on three axes:

  • The image definition isn't currently open-sourced (there's not a super strong reason for this, but splitting it out of our in-house repo is still work that needs to be accounted for and time-boxed to a degree)
  • The Ruby version installed in the container is just whatever dnf pulls down from the Fedora repos at the time of image build. Per Repology, no version of Fedora packages 3.0.6; the closest we can get is 3.0.5 on Fedora 35 (which is the version this internal image currently targets). Building a newer Ruby from source (or installing via ruby-build, or whatever) is both possible and something I've dealt with before on prior org's infra teams, but it's again non-trivial, and work that needs to be planned out time-wise.
  • Even if we solve all of that, the internal image fails to build due to some cryptic interaction between DNF, Docker, and (at least) my host filesystem:
 > [2/2] RUN dnf upgrade -y     && dnf install [REDACTED LIST OF PACKAGES]:
#0 78.68 Fedora 35 - x86_64                              1.0 MB/s |  79 MB     01:17    
#0 78.70 Error: Cannot create directory "/var/cache/dnf/fedora-37d3cae0527b6391/repodata": Invalid argument

This may be a weird "I use ZFS on my host system" quirk, or it may be an issue with Void Linux's Docker builds, or it may be an outright problem with how we build images. I'd have to do some testing (and probably tap @maestromac, who is on Fedora with, I presume, ext4 or btrfs root fs, for more data points to narrow down the cause of failure)

I suspect getting this PR merged is thus a minimum of a week of active (at 75%+ of a full-time in-house Forem engineer's available working time) effort.

@heliocola
Copy link
Contributor Author

@klardotsh : thank you for looking into it and for the detailed comment.
If quay.io is a requirement for CI (at least), maybe is better to focus on Ruby 3.1 (.0 or .4) series.

Ruby 3.0.* EOL is in less than 1 year (expected for 2024-03-31), and going to 3.0.6 was just a strategy to go to latest 3.0 before upgrading it to 3.1.

I believe the changes in this PR (cgi and APP_DOMAIN without :3000) will be needed for Ruby 3.1 as well.
There is a 3.1.0-testing in https://quay.io/repository/forem/ruby?tab=tags&tag=latest, so I will give it a try.

@klardotsh
Copy link
Contributor

Attempting to upgrade directly to Ruby 3.1+ does not solve point three above where the images currently do not build (at least for me, so far). That's something we need to figure out internally before we can take any upgrades to Ruby at all.

I do think taking the final patch release of the 3.0 series before moving to 3.1 is a good idea in general, so I want to keep this PR going and advocate internally (I've already started these discussions) for making the time to unblock it in the ways mentioned above :)

@klardotsh
Copy link
Contributor

Additionally: for what it's worth, the forem/ruby image isn't only necessary for CI purposes, it's also what eventually underlies forem/forem:development, which (if I recall correctly) is built out of the Dockerfile at the root of the repo, and is what powers all docker-compose based workflows - for at least some of us internally, and I'm sure others in the open-source community, that is our primary way of running Forem locally for development, and can't be ignored or sidelined.

Copy link
Contributor

@jaw6 jaw6 left a comment

Choose a reason for hiding this comment

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

@heliocola I really appreciate you opening this PR! I'm mostly a 👍 but as mentioned, I'd prefer to split the proposed .env change into a separate PR so we can merge this one without delay.

.env_sample Outdated
@@ -1,7 +1,7 @@
# Development options

# App core values
APP_DOMAIN="localhost:3000"
APP_DOMAIN="forem.test"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @heliocola — I'm not sure about this change (I'll defer to @maestromac and @klardotsh there) but the Ruby upgrade looks good without it, and this change seems unrelated. I'd suggest maybe moving this change to a separate PR, that way the Ruby upgrade can proceed on its own?

@@ -173,3 +173,5 @@ group :test do
gem "with_model", "~> 2.1.6" # Dynamically build a model within an RSpec context
gem "zonebie", "~> 0.6.1" # Runs your tests in a random timezone
end

gem "cgi", "~> 0.3.6" # Support for the Common Gateway Interface protocol.
Copy link
Contributor

Choose a reason for hiding this comment

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

For other reviewers:

We haven't upgraded our Ruby in over a year 😱

@maestromac maestromac removed the request for review from a team June 21, 2023 14:39
@mirie mirie removed the request for review from dukegreene June 22, 2023 15:03
@maestromac maestromac added the blocked blocked by internal or external issues label Jun 22, 2023
@maestromac maestromac marked this pull request as draft June 22, 2023 15:05
@klardotsh
Copy link
Contributor

Hey @heliocola, just letting you know that the infra team here at Forem (that's @maestromac and I) are digging into this actively. I don't yet know when we'll have this unblocked, but hopefully within the coming days to weeks. Steps we're taking:

  • Working on a new forem/ruby container image where Ruby versions will track the upstream _/ruby containers, rather than tracking the Ruby versions Fedora packages.
  • This new container image will be open-source as part of this forem/forem repo, rather than living in our internal company infrastructure repo (which is private).
  • I'm going to be personally testing ARM64 support (this refs Arm64 Support #16765) as part of this: I'm making absolutely no promises, it's kind of a tangential/stretch goal that @benhalpern and I talked about and agreed was worth seeing if we could address as part of the same work.
  • Automating the build and publish steps of that base image so that future updates should be relatively straightforward (bumping a version number in the base Dockerfile and opening a PR).

I'll circle back when I know more. Thanks also to @jaw6 for the review above: I agree that I'd prefer to see .env changes separated to a different PR that can be reviewed on its own merits. I don't actually know that forem.test is the right value for APP_DOMAIN, given that there are no A records in public domain registrars for it (is this something I was supposed to add to /etc/hosts and just never did?):

(woods) ~  » drill forem.test
;; ->>HEADER<<- opcode: QUERY, rcode: NXDOMAIN, id: 10163
;; flags: qr aa rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 
;; QUESTION SECTION:
;; forem.test.	IN	A

;; ANSWER SECTION:

;; AUTHORITY SECTION:
.	86400	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2023062202 1800 900 604800 86400

;; ADDITIONAL SECTION:

;; Query time: 24 msec
;; SERVER: 1.1.1.1
;; WHEN: Thu Jun 22 12:21:08 2023
;; MSG SIZE  rcvd: 103

@klardotsh
Copy link
Contributor

Addendum: reffing #19626 as well here (the issue form of the discussion I linked above).

klardotsh added a commit that referenced this pull request Jun 23, 2023
This builds a Debian-derived base image that targets Ruby 3.0.2 (our
current version lock) to replace `quay.io/forem/ruby`, which is based on
Fedora 35 (and as such, lacks ARM64 support).

The building of this image is not yet automated, I intend to add that as
a follow-up some time vaguely soon-ish. This has been built and pushed
to a temporary tag,
[ghcr.io/forem/ruby:klardotsh-test](https://github.com/orgs/forem/packages/container/ruby/103882793?tag=klardotsh-test).
Once this merges, I'll build and push the result in main (pending any
revisions that come up in PR review) with the following incantation,
which will generate a multiarch manifest:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile.base . -t ghcr.io/forem/ruby:latest -t ghcr.io/forem/ruby:$(git rev-parse --short HEAD) --push
```

This refs, but does not complete, #19626, and is one of several blockers
on the path to getting #19603 merged.
klardotsh added a commit that referenced this pull request Jun 24, 2023
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
klardotsh added a commit that referenced this pull request Jun 28, 2023
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
klardotsh added a commit that referenced this pull request Jun 28, 2023
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
@heliocola
Copy link
Contributor Author

@maestromac , @klardotsh , @jaw6 : TL'DR: I will close this PR and open a fresh one & clean one.
Once this is unblocked, it can be reviewed again, and merged.

The Long story

Here is a summary of my latest changes:

1. Removed the sym link on .env.test and create its own file.

I've tried to change COMMUNITY_NAME to be DEV(test) but I found out rspec and cypress tests expecting for DEV(local) so I've changed back the value in .env.test to DEV(local).
I did however refactored some rspec tests to check for what is in .env.test.

2. Fixed/Changed some rubocop offenses

Duo to changing some files for the item above, I've had to fix some rubocop offenses.
The one that seems most important is:

  click_button("button", text: /\ASave changes\z/)

instead of

  find("button", text: /\ASave changes\z/).click

But this change cause CI because click_button only works when button is disabled and serveral test were failing with:

Capybara::ElementNotFound:
       Unable to find button "button" that is not disabled

But reverting it, I have to wrestle with rubocop to commit the changes.
So, given this PR is stale and blocked, I will close and open a fresh one with the changes needed for Ruby 3.0.6.

@heliocola heliocola closed this Jun 28, 2023
klardotsh added a commit that referenced this pull request Jun 28, 2023
…e. (#19632)

This builds a Debian-derived base image that targets Ruby 3.0.2 (our
current version lock) to replace `quay.io/forem/ruby`, which is based on
Fedora 35 (and as such, lacks ARM64 support).

The building of this image is not yet automated, I intend to add that as
a follow-up some time vaguely soon-ish. This has been built and pushed
to a temporary tag,
[ghcr.io/forem/ruby:klardotsh-test](https://github.com/orgs/forem/packages/container/ruby/103882793?tag=klardotsh-test).
Once this merges, I'll build and push the result in main (pending any
revisions that come up in PR review) with the following incantation,
which will generate a multiarch manifest:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile.base . -t ghcr.io/forem/ruby:latest -t ghcr.io/forem/ruby:$(git rev-parse --short HEAD) --push
```

This refs, but does not complete, #19626, and is one of several blockers
on the path to getting #19603 merged.
klardotsh added a commit that referenced this pull request Jun 28, 2023
This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
dukegreene pushed a commit that referenced this pull request Jun 28, 2023
…e. (#19632)

This builds a Debian-derived base image that targets Ruby 3.0.2 (our
current version lock) to replace `quay.io/forem/ruby`, which is based on
Fedora 35 (and as such, lacks ARM64 support).

The building of this image is not yet automated, I intend to add that as
a follow-up some time vaguely soon-ish. This has been built and pushed
to a temporary tag,
[ghcr.io/forem/ruby:klardotsh-test](https://github.com/orgs/forem/packages/container/ruby/103882793?tag=klardotsh-test).
Once this merges, I'll build and push the result in main (pending any
revisions that come up in PR review) with the following incantation,
which will generate a multiarch manifest:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile.base . -t ghcr.io/forem/ruby:latest -t ghcr.io/forem/ruby:$(git rev-parse --short HEAD) --push
```

This refs, but does not complete, #19626, and is one of several blockers
on the path to getting #19603 merged.
klardotsh added a commit that referenced this pull request Jun 29, 2023
…#19633)

This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
rt4914 pushed a commit that referenced this pull request Jun 29, 2023
…#19633)

This "rebases" our application images off of the new Ruby base image
added in #19632, and fixes numerous problems and quirks with how the
images were built along the way. Notably:

- Issues where layers attempted to delete files in prior layers have
  been resolved (this caused build failures on some Docker filesystem
  drivers, notably overlay2).

- Bundler is no longer allowed to deviate from or modify the lockfile
  (`BUNDLE_FROZEN` is now `true`).

- `git(1)` is no longer required to live inside the container and `.git`
  is no longer required to be copied into the Docker build context, as
  these were only used to calculate `FOREM_BUILD_SHA`, which is now
  passed in as a Build Argument to the container build context.

- The entire source tree is no longer `chmod` in one giant swing, which
  ran so long on my system (as just one example) that I gave up after
  15-20 minutes and issued it a `SIGTERM`. Instead, `COPY --chown` is
  used more heavily and ensures the `APP_USER` will have access to the
  requisite files.

This new container image appears to build successfully for
`linux/arm64`, which refs (but does not complete) #19626. Currently,
such builds aren't automated , and must be built on a developer
workstation. For example:

```sh
docker buildx build --platform linux/amd64,linux/arm64 -f Containerfile . -t ghcr.io/forem/forem:klardotsh-test --push --build-arg VCS_REF=$(git rev-parse --short HEAD)
```

In the meantime, the existing `linux/amd64`-only BuildKite scripts have
been updated to allow this PR to merge as a separate unit, and CI
refactors to enable the multiarch builds of `linux/arm64,linux/amd64`
can come later when more time is available.

This is one of several blockers on the path to getting #19603 merged.
The next step in that chronology will be rebasing that work on top of
this work, which *should* be, on the containerization side, as
straightforward as bumping `Containerfile.base` to reference the new
upstream image, rebuilding the base container, and then bumping the
reference in `Containerfile`.
@mirie mirie mentioned this pull request Jul 3, 2023
2 tasks
@heliocola heliocola deleted the ruby/latest_3_0_t2 branch July 10, 2023 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked blocked by internal or external issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants