sourcegraph/cmd/server/image_test.yaml
William Bezuidenhout 972ee32351
feat(frontend): do not embed frontend assets anymore (#63946)
* Frontend no longer embeds the assets intead it reads from the local
filesystem assets.
* Generally the frontend and server cmd targets will use the
`//client/web/dist:copy_bundle` target to create a tarball for the
oci_image. `copy_bundle` puts all the assets at `assets-dist`
* For integration tests, frontend and server have the `no_client_bundle`
target variants. For these oci_images, instead of the `tar_bundle` which
is just a tar'd `copy_bundle` we use the `tar_dummy_manifest` which is
just a tar that contains a dummy manifest.
* By default we expect assets to be at `/assets-dist`
* Renamed DevProvider to DirProvider

## Why
By 'breaking' the dependency of frontend requiring assets to be built we
essentially stop a common cache invalidation scenario that happens:
- someone makes a frontend change = assets need to be rebuilt

By decoupling assets from the frontend binary and moving the packing of
assets to the building of the frontend and server images we will have a
better cache hit rate (theoretically).

Thus with this change, when:
* client/web is change and nothing else ... only assets will have to
rebuilt and cached versions of the backend will be used
* if only backend code has changed ... cached assets will be used

Closes DINF-115

## Test plan
  sg start - web app opens and can search. Local dev assets get loaded
 sg test bazel-integration-test - server image gets built with **only**
dummy web manifest. Also verified by running `sg bazel run
//cmd/server:no_client_bundle.image` and then inspect container
 sg test bazel-e2e - server image gets built with bundle and all tests
pass
 [main dry
run](https://buildkite.com/sourcegraph/sourcegraph/builds/284042#0190e54c-14d9-419e-95ca-1198dc682048)

## Changelog
- frontend: assets are no longer bundled with binary through `go:embed`.
Instead assets are now added to the frontend container at `assets-dist`.
2024-07-31 15:17:52 +02:00

125 lines
2.7 KiB
YAML

schemaVersion: "2.0.0"
commandTests:
- name: "server binary is runnable"
command: "/server"
envVars:
- key: "SANITY_CHECK"
value: "true"
# Sourcegraph binaries, run as a single test case to keep test case count short.
- name: "sourcegraph binaries are runnable"
command: "/opt/image_tests/test_services.sh"
# Base packages
- name: "packages binaries are runnable"
command: "/opt/image_tests/test_packages.sh"
- name: "scip-ctags is runnable"
command: "/usr/local/bin/scip-ctags"
envVars:
- key: "SANITY_CHECK"
value: "true"
# Git
- name: "git p4 is runnable"
command: "git"
args:
- p4
expectedOutput: ["valid commands: submit"]
exitCode: 2
# P4-fusion
- name: "p4-fusion is runnable"
command: "p4-fusion"
args:
expectedOutput: [ "--noBaseCommit" ]
exitCode: 1
# Zoekt binaries
- name: "zoket binaries are runnable"
command: "/opt/image_tests/test_zoekt.sh"
# SSH
- name: "ssh is runnable"
command: "ssh"
exitCode: 255
# Correct users and groups
- name: "correct users exist"
command: "cat"
args:
- '/etc/passwd'
expectedOutput: [
"sourcegraph:x:100:101",
"postgres:x:70:70",
"nginx:x:101:102",
"redis:x:102:103",
"grafana:x:103:104",
]
# TODO(security): This container should not be running as root
# - name: "not running as root"
# command: "/usr/bin/id"
# args:
# - -u
# excludedOutput: ["^0"]
# exitCode: 0
fileExistenceTests:
# Prometheus
- name: '/prometheus.sh'
path: '/prometheus.sh'
shouldExist: true
uid: 0
gid: 0
permissions: '-r-xr-xr-x'
- name: '/alertmanager.sh'
path: '/alertmanager.sh'
shouldExist: true
uid: 0
gid: 0
permissions: '-r-xr-xr-x'
# Grafana
# - name: 'Dashboard config'
# path: '/sg_config_grafana/provisioning/dashboards/sourcegraph/gitserver.json'
# shouldExist: true
# uid: 0
# gid: 0
# permissions: '-r-xr-xr-x'
# /sg_config_prometheus configuration
- name: '/sg_config_prometheus/prometheus.yml'
path: '/sg_config_prometheus/prometheus.yml'
shouldExist: true
uid: 0
gid: 0
permissions: '-rwxrwxrwx'
- name: '/sg_config_prometheus/alertmanager.yml'
path: '/sg_config_prometheus/alertmanager.yml'
shouldExist: true
uid: 0
gid: 0
permissions: '-rwxrwxrwx'
- name: '/version.txt'
path: '/version.txt'
shouldExist: true
uid: 0
gid: 0
- name: '/timestamp.txt'
path: '/timestamp.txt'
shouldExist: true
uid: 0
gid: 0
- name: '/assets-dist/web.manifest.json'
path: '/assets-dist/web.manifest.json'
shouldExist: true
metadataTest:
envVars:
- key: GO111MODULES
value: 'on'
- key: LANG
value: 'en_US.utf8'