Skip to content

chore: Reduce deployment times by excluding Docker images #1945

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

Merged
merged 5 commits into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -353,21 +353,21 @@ jobs:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}

- uses: goreleaser/goreleaser-action@v3
with:
install-only: true

- name: Cache Node
id: cache-node
uses: actions/cache@v3
with:
path: |
**/node_modules
.eslintcache
key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
key: js-${{ runner.os }}-release-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
js-${{ runner.os }}-

- uses: goreleaser/goreleaser-action@v3
with:
install-only: true

- name: Build site
run: make -B site/out/index.html

Expand All @@ -377,18 +377,6 @@ jobs:
version: latest
args: release --snapshot --rm-dist --skip-sign

- uses: actions/upload-artifact@v3
with:
name: coder_windows_amd64.zip
path: ./dist/coder_*_windows_amd64.zip
retention-days: 7

- uses: actions/upload-artifact@v3
with:
name: coder_linux_amd64.tar.gz
path: ./dist/coder_*_linux_amd64.tar.gz
retention-days: 7

- name: Install Release
run: |
gcloud config set project coder-dogfood
Expand All @@ -400,6 +388,14 @@ jobs:
- name: Start
run: gcloud compute ssh coder -- sudo service coder restart

- uses: actions/upload-artifact@v3
with:
name: coder
path: |
./dist/coder_*_linux_amd64.tar.gz
./dist/coder_*_windows_amd64.zip
retention-days: 7

test-js:
name: "test/js"
runs-on: ubuntu-latest
Expand Down
7 changes: 4 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ nfpms:
- src: coder.service
dst: /usr/lib/systemd/system/coder.service

# Image templates are empty on snapshots to avoid lengthy builds for development.
dockers:
- image_templates: ["ghcr.io/coder/coder:{{ .Tag }}-amd64"]
- image_templates: ["{{ if not .IsSnapshot }}ghcr.io/coder/coder:{{ .Tag }}-amd64{{ end }}"]
id: coder-linux
dockerfile: Dockerfile
use: buildx
Expand All @@ -108,7 +109,7 @@ dockers:
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
- image_templates: ["ghcr.io/coder/coder:{{ .Tag }}-arm64"]
- image_templates: ["{{ if not .IsSnapshot }}ghcr.io/coder/coder:{{ .Tag }}-arm64{{ end }}"]
goarch: arm64
dockerfile: Dockerfile
use: buildx
Expand All @@ -121,7 +122,7 @@ dockers:
- --label=org.opencontainers.image.version={{ .Tag }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=AGPL-3.0
- image_templates: ["ghcr.io/coder/coder:{{ .Tag }}-armv7"]
- image_templates: ["{{ if not .IsSnapshot }}ghcr.io/coder/coder:{{ .Tag }}-armv7{{ end }}"]
goarch: arm
goarm: "7"
dockerfile: Dockerfile
Expand Down
5 changes: 3 additions & 2 deletions site/webpack.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const dashboardHTMLPluginConfig = new HtmlWebpackPlugin({
template: path.join(templatePath, "index.html"),
})

export const commonWebpackConfig: Configuration = {
export const createCommonWebpackConfig = (options?: { skipTypecheck: boolean }): Configuration => ({
// entry defines each "page" or "chunk". In v1, we have two "pages":
// dashboard and terminal. This is desired because the terminal has the xterm
// vendor, and it is undesireable to load all of xterm on a dashboard
Expand Down Expand Up @@ -78,6 +78,7 @@ export const commonWebpackConfig: Configuration = {
loader: "ts-loader",
options: {
configFile: "tsconfig.prod.json",
transpileOnly: options?.skipTypecheck,
},
},
],
Expand Down Expand Up @@ -106,4 +107,4 @@ export const commonWebpackConfig: Configuration = {

// plugins customize the build process
plugins: [environmentPlugin, dashboardHTMLPluginConfig],
}
})
6 changes: 4 additions & 2 deletions site/webpack.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"
import { Configuration } from "webpack"
import "webpack-dev-server"
import { commonWebpackConfig } from "./webpack.common"
import { createCommonWebpackConfig } from "./webpack.common"

const commonWebpackConfig = createCommonWebpackConfig()

const commonPlugins = commonWebpackConfig.plugins || []

const commonRules = commonWebpackConfig.module?.rules || []

const config: Configuration = {
...commonWebpackConfig,
...createCommonWebpackConfig,

// devtool controls how source maps are generated. In development, we want
// more details (less optimized) for more readability and an easier time
Expand Down
8 changes: 7 additions & 1 deletion site/webpack.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import CopyWebpackPlugin from "copy-webpack-plugin"
import CSSMinimizerPlugin from "css-minimizer-webpack-plugin"
import MiniCSSExtractPlugin from "mini-css-extract-plugin"
import { Configuration } from "webpack"
import { commonWebpackConfig } from "./webpack.common"
import { createCommonWebpackConfig } from "./webpack.common"

const commonWebpackConfig = createCommonWebpackConfig({
// This decreases compilation time when publishing releases.
// The "test/js" step will already catch any TypeScript compilation errors.
skipTypecheck: true,
})

const commonPlugins = commonWebpackConfig.plugins || []

Expand Down