Skip to content

Commit 79364b0

Browse files
committed
Merge branch 'main' into landau/fix-prerelease-job
2 parents 668556b + 63a4483 commit 79364b0

File tree

8 files changed

+228
-208
lines changed

8 files changed

+228
-208
lines changed

.github/workflows/cli-post-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ jobs:
2424
run: |
2525
tmp_file=$(mktemp)
2626
echo "${{ github.ref_name }}" > $tmp_file
27-
aws s3 cp $tmp_file s3://releases.jetpack.io/devbox/latest/version
2827
aws s3 cp $tmp_file s3://releases.jetpack.io/devbox/stable/version

examples/stacks/drupal/composer.lock

Lines changed: 169 additions & 177 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/stacks/drupal/web/.htaccess

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ AddEncoding gzip svgz
158158
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
159159
RewriteCond %{HTTP:Accept-encoding} gzip
160160
RewriteCond %{REQUEST_FILENAME}\.gz -s
161-
RewriteRule ^(.*css_[a-zA-Z0-9-_])\.css$ $1\.css\.gz [QSA]
161+
RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.gz [QSA]
162162

163163
# Serve gzip compressed JS files if they exist and the client accepts gzip.
164164
RewriteCond %{HTTP:Accept-encoding} gzip
165165
RewriteCond %{REQUEST_FILENAME}\.gz -s
166-
RewriteRule ^(.*js_[a-zA-Z0-9-_])\.js$ $1\.js\.gz [QSA]
166+
RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.gz [QSA]
167167

168168
# Serve correct content types, and prevent double compression.
169169
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]

examples/stacks/drupal/web/sites/default/default.settings.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,25 @@
531531
*/
532532
# $settings['file_additional_public_schemes'] = ['example'];
533533

534+
/**
535+
* File schemes whose paths should not be normalized:
536+
*
537+
* Normally, Drupal normalizes '/./' and '/../' segments in file URIs in order
538+
* to prevent unintended file access. For example, 'private://css/../image.png'
539+
* is normalized to 'private://image.png' before checking access to the file.
540+
*
541+
* On Windows, Drupal also replaces '\' with '/' in URIs for the local
542+
* filesystem.
543+
*
544+
* If file URIs with one or more scheme should not be normalized like this, then
545+
* list the schemes here. For example, if 'porcelain://china/./plate.png' should
546+
* not be normalized to 'porcelain://china/plate.png', then add 'porcelain' to
547+
* this array. In this case, make sure that the module providing the 'porcelain'
548+
* scheme does not allow unintended file access when using '/../' to move up the
549+
* directory tree.
550+
*/
551+
# $settings['file_sa_core_2023_005_schemes'] = ['porcelain'];
552+
534553
/**
535554
* Private file path:
536555
*

internal/boxcli/root.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"strings"
1212

1313
"github.com/spf13/cobra"
14+
"go.jetpack.io/devbox/internal/build"
1415

1516
"go.jetpack.io/devbox/internal/boxcli/midcobra"
1617
"go.jetpack.io/devbox/internal/cloud/openssh/sshshim"
@@ -34,10 +35,19 @@ func RootCmd() *cobra.Command {
3435
Use: "devbox",
3536
Short: "Instant, easy, predictable development environments",
3637
PersistentPreRun: func(cmd *cobra.Command, args []string) {
37-
vercheck.CheckVersion(cmd.ErrOrStderr())
3838
if flags.quiet {
3939
cmd.SetErr(io.Discard)
4040
}
41+
42+
// Skip CheckVersion for `devbox global shellenv` because users will include that
43+
// command in their shellrc files, and we don't want to bother them everytime they
44+
// open their terminals.
45+
//
46+
// Skip CheckVersion for engineers building devbox during development.
47+
if !strings.HasPrefix(cmd.CommandPath(), "devbox global shellenv") &&
48+
!build.IsDev {
49+
vercheck.CheckVersion(cmd.ErrOrStderr())
50+
}
4151
},
4252
RunE: func(cmd *cobra.Command, args []string) error {
4353
return cmd.Help()
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
FROM alpine:3
1+
FROM debian:stable-slim
22

3-
# Setting up devbox user
4-
ENV DEVBOX_USER=devbox
5-
RUN adduser -h /home/$DEVBOX_USER -D -s /bin/bash $DEVBOX_USER
6-
RUN addgroup sudo
7-
RUN addgroup $DEVBOX_USER sudo
8-
RUN echo " $DEVBOX_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
3+
# Step 1: Installing dependencies
4+
RUN apt-get update
5+
RUN apt-get -y install bash binutils git xz-utils wget sudo
96

10-
# installing dependencies
11-
RUN apk add --no-cache bash binutils git libstdc++ xz sudo
7+
# Step 2: Setting up devbox user
8+
ENV DEVBOX_USER=devbox
9+
RUN adduser $DEVBOX_USER
10+
RUN usermod -aG sudo $DEVBOX_USER
11+
RUN echo "devbox ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$DEVBOX_USER
1212

1313
USER $DEVBOX_USER
1414

15-
# installing devbox
16-
RUN wget --quiet --output-document=/dev/stdout https://get.jetpack.io/devbox | bash -s -- -f
15+
# Step 3: Installing devbox
16+
RUN wget --quiet --output-document=/dev/stdout https://get.jetpack.io/devbox | bash -s -- -f
1717
RUN chown -R "${DEVBOX_USER}:${DEVBOX_USER}" /usr/local/bin/devbox
1818

19-
# nix installer script
20-
RUN wget --quiet --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --no-daemon
19+
# Step 4: Installing Nix
20+
RUN wget --output-document=/dev/stdout https://nixos.org/nix/install | sh -s -- --no-daemon
2121
RUN . ~/.nix-profile/etc/profile.d/nix.sh
2222
# updating PATH
2323
ENV PATH="/home/${DEVBOX_USER}/.nix-profile/bin:/home/${DEVBOX_USER}/.devbox/nix/profile/default/bin:${PATH}"
2424

25+
# Step 5: Installing your devbox project
2526
WORKDIR /code
2627
RUN sudo chown $DEVBOX_USER:root /code
2728
COPY devbox.json devbox.json
28-
RUN devbox run -- echo "Installing packages"
29+
RUN devbox install
2930
CMD ["devbox", "shell"]
30-

internal/nix/input.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ type Input struct {
2727
func InputFromString(s string, l lock.Locker) *Input {
2828
u, _ := url.Parse(s)
2929
if u.Path == "" && u.Opaque != "" && u.Scheme == "path" {
30-
u.Path = filepath.Join(l.ProjectDir(), u.Opaque)
31-
u.Opaque = ""
30+
// This normalizes url paths to be absolute. It also ensures all
31+
// path urls have a single slash (instead of possibly 3 slashes)
32+
u, _ = url.Parse("path:" + filepath.Join(l.ProjectDir(), u.Opaque))
3233
}
3334
return &Input{*u, l}
3435
}
@@ -136,19 +137,18 @@ func (i *Input) PackageAttributePath() (string, error) {
136137
strings.Join(lo.Keys(infos), ", ")
137138
}
138139
return "", usererr.New(
139-
"Flake \"%s\" is ambiguous. %s",
140+
"Package \"%s\" is ambiguous. %s",
140141
i.String(),
141142
outputs,
142143
)
143144
}
144145

145-
return "", usererr.New("Flake \"%s\" was not found", i.String())
146+
return "", usererr.New("Package \"%s\" was not found", i.String())
146147
}
147148

148149
func (i *Input) urlWithoutFragment() string {
149150
u := i.URL // get copy
150151
u.Fragment = ""
151-
// This will produce urls with extra slashes after the scheme, but that's ok
152152
return u.String()
153153
}
154154

@@ -161,7 +161,7 @@ func (i *Input) hash() string {
161161
}
162162

163163
func (i *Input) validateExists() (bool, error) {
164-
if i.IsDevboxPackage() {
164+
if i.isVersioned() {
165165
version := i.version()
166166
if version == "" && i.isVersioned() {
167167
return false, usererr.New("No version specified for %q.", i.Path)

internal/nix/input_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ func TestInput(t *testing.T) {
2929
{
3030
pkg: "path:path/to/my-flake#my-package",
3131
isFlake: true,
32-
name: "my-flake-c7758d",
33-
urlWithoutFragment: "path://" + filepath.Join(projectDir, "path/to/my-flake"),
34-
urlForInput: "path://" + filepath.Join(projectDir, "path/to/my-flake"),
32+
name: "my-flake-eaedce",
33+
urlWithoutFragment: "path:" + filepath.Join(projectDir, "path/to/my-flake"),
34+
urlForInput: "path:" + filepath.Join(projectDir, "path/to/my-flake"),
3535
},
3636
{
3737
pkg: "path:.#my-package",
3838
isFlake: true,
39-
name: "my-project-744eaa",
40-
urlWithoutFragment: "path://" + projectDir,
41-
urlForInput: "path://" + projectDir,
39+
name: "my-project-bbeb05",
40+
urlWithoutFragment: "path:" + projectDir,
41+
urlForInput: "path:" + projectDir,
4242
},
4343
{
4444
pkg: "path:/tmp/my-project/path/to/my-flake#my-package",

0 commit comments

Comments
 (0)