Skip to content

Commit

Permalink
update to 1.31.0-next.2 (#56)
Browse files Browse the repository at this point in the history
update to 1.31.0-next.2

main goal was to update backstage and dependencies, but there are also multiple changes in the build, including:

migration to yarn 3.5.
performed migration to new backstage auth and backend API.
removed deprecated plugins

Reviewed-by: Vladimir Hasko <[email protected]>
  • Loading branch information
vladimirvshivkov authored Oct 8, 2024
1 parent e4687fc commit ea18cb6
Show file tree
Hide file tree
Showing 48 changed files with 38,587 additions and 31,180 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.git
#.yarn/cache
#.yarn/install-state.gz
#node_modules
#packages/*/src
#packages/*/node_modules
Expand All @@ -13,3 +11,5 @@ packages/*/dist
packages/*/node_modules
plugins/*/dist
plugins/*/node_modules
.yarn/cache
.yarn/install-state.gz
51 changes: 25 additions & 26 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,46 @@ env:
PROJECT: backstage

jobs:

build:
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
"${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}"
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
"${{ secrets.REGISTRY }}/${{ env.ORG }}/${{ env.PROJECT }}"
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: false

push_if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ site

# vscode database functionality support files
*.session.sql
app-config.yaml
541 changes: 541 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

873 changes: 873 additions & 0 deletions .yarn/releases/yarn-3.5.0.cjs

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# test directories
__tests__
test
tests
powered-test

# asset directories
docs
doc
website
images
assets

# examples
example
examples

# code coverage directories
coverage
.nyc_output

# build scripts
Makefile
Gulpfile.js
Gruntfile.js

# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml

# misc
*.md
13 changes: 13 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.5.0.cjs
41 changes: 23 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# syntax=docker/dockerfile:1.2

# Stage 1 - Create yarn install skeleton layer
FROM node:18-bookworm-slim AS packages
FROM node:20-bookworm-slim AS packages

WORKDIR /app
COPY package.json yarn.lock ./

# Set up Yarn 3.5
RUN corepack enable && \
corepack prepare [email protected] --activate

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn .yarn

COPY packages packages

Expand All @@ -14,12 +20,13 @@ COPY plugins plugins
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {} \+

# Stage 2 - Install dependencies and build packages
FROM node:18-bookworm-slim AS build
FROM node:20-bookworm-slim AS build

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential && \
yarn config set python /usr/bin/python3
apt-get install -y --no-install-recommends python3 g++ git build-essential && \
corepack enable && \
corepack prepare [email protected] --activate

# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
Expand All @@ -34,26 +41,27 @@ COPY --from=packages --chown=node:node /app .
ENV CYPRESS_CACHE_FOLDER /app/cypress_cache
RUN mkdir -p /app/cypress_cache && chown -R node:node /app/cypress_cache

RUN yarn install --frozen-lockfile --network-timeout 600000
RUN yarn install --immutable

COPY --chown=node:node . .

RUN yarn postinstall

RUN yarn tsc
RUN yarn --cwd packages/backend build
# If you have not yet migrated to package roles, use the following command instead:
# RUN yarn --cwd packages/backend backstage-cli backend:bundle --build-dependencies
RUN yarn build:backend

RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
&& tar xzf packages/backend/dist/skeleton.tar.gz -C packages/backend/dist/skeleton \
&& tar xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist/bundle

# Stage 3 - Build the actual backend image and install production dependencies
FROM node:18-bookworm-slim
FROM node:20-bookworm-slim

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential && \
yarn config set python /usr/bin/python3
corepack enable && \
corepack prepare [email protected] --activate

# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
Expand All @@ -63,19 +71,16 @@ RUN apt-get update && \
# From here on we use the least-privileged `node` user to run the backend.
USER node

# This should create the app dir as `node`.
# If it is instead created as `root` then the `tar` command below will
# fail: `can't create directory 'packages/': Permission denied`.
# If this occurs, then ensure BuildKit is enabled (`DOCKER_BUILDKIT=1`)
# so the app dir is correctly created as `node`.
WORKDIR /app

# Copy the install dependencies from the build stage and context
COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
COPY --from=build --chown=node:node /app/package.json /app/yarn.lock /app/.yarnrc.yml ./
COPY --from=build --chown=node:node /app/.yarn ./.yarn
COPY --from=build --chown=node:node /app/packages/backend/dist/skeleton/ ./

RUN mkdir -p /app/cypress_cache && chown -R node:node /app/cypress_cache

RUN yarn install --frozen-lockfile --production --network-timeout 600000
RUN yarn workspaces focus

# Copy the built packages from the build stage
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ yarn dev
```

To build container, run:

```sh
yarn tsc
yarn build:backend
Expand Down
4 changes: 2 additions & 2 deletions app-config.production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ backend:
cors:
origin: https://backstage.eco.tsi-dev.otc-service.com

# config options: https://node-postgres.com/api/client
# config options: https://node-postgres.com/apis/client
# database:
# client: pg
# connection:
Expand All @@ -37,7 +37,7 @@ backend:
integrations:
gitea:
- host: gitea.eco.tsi-dev.otc-service.com
password: "${GITEA_TOKEN}"
password: '${GITEA_TOKEN}'
github:
- host: github.com
apps:
Expand Down
4 changes: 2 additions & 2 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ proxy:
headers:
X-Api-Key: "${DEPENDENCYTRACK_TOKEN}"

scaffolder:
# see https://backstage.io/docs/features/software-templates/configuration for software template options
# scaffolder:
# # see https://backstage.io/docs/features/software-templates/configuration for software template options

# Reference documentation http://backstage.io/docs/features/techdocs/configuration
# Note: After experimenting with basic setup, use CI/CD to generate docs
Expand Down
2 changes: 1 addition & 1 deletion backstage.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.26.3"
"version": "1.31.0-next.2"
}
12 changes: 12 additions & 0 deletions knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://unpkg.com/knip@3/schema.json",
"ignore": ["**/setupTests.ts", "**/.eslintrc.js", "**/config.d.ts"],
"ignoreDependencies": [
"better-sqlite3",
"app",
"@testing-library/jest-dom",
"webpack-env",
"lint-staged",
"@types/lodash"
]
}
62 changes: 36 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"engines": {
"node": "16 || 18"
"node": "18 || 20"
},
"scripts": {
"dev": "concurrently \"yarn start\" \"yarn start-backend\"",
Expand All @@ -17,12 +17,15 @@
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test:all": "backstage-cli repo test --coverage",
"lint": "backstage-cli package lint",
"test:e2e": "playwright test",
"fix": "backstage-cli repo fix",
"lint": "backstage-cli repo lint --since origin/master",
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"create-plugin": "backstage-cli create-plugin --scope internal",
"new": "backstage-cli new --scope internal",
"export-dynamic": "janus-cli package export-dynamic-plugin"
"knip": "knip",
"prepare": "husky",
"postinstall": "husky || true && patch-package"
},
"workspaces": {
"packages": [
Expand All @@ -31,37 +34,44 @@
]
},
"devDependencies": {
"@backstage/cli": "^0.26.4",
"@janus-idp/cli": "^1.8.0",
"@spotify/prettier-config": "^12.0.0",
"concurrently": "^8.1.0",
"node-gyp": "^9.0.0",
"prettier": "3.2.5",
"typescript": "~5.0.0"
},
"resolutions": {
"@types/react": "^17",
"@types/react-dom": "^17"
"@backstage/cli": "^0.27.1",
"@backstage/e2e-test-utils": "^0.1.1",
"@playwright/test": "^1.32.3",
"@spotify/prettier-config": "^15.0.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.10.5",
"concurrently": "^9.0.0",
"eslint": "^8.6.0",
"fs-extra": "11.2.0",
"husky": "^9.0.0",
"jest": "^29.7.0",
"knip": "^5.0.0",
"lint-staged": "^15.0.0",
"node-fetch": "^2.6.7",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^3.0.0",
"typescript": "~5.4.0"
},
"prettier": "@spotify/prettier-config",
"lint-staged": {
"*.{js,jsx,ts,tsx,mjs,cjs}": [
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md}": [
"*.{json,md,yaml,yml}": [
"prettier --write"
]
},
"dependencies": {
"@backstage/backend-dynamic-feature-service": "^0.2.9",
"@backstage/test-utils": "^1.5.4",
"@types/passport-oauth2": "^1.4.12",
"passport-oauth2": "^1.7.0"
"@backstage/plugin-kubernetes": "^0.11.14",
"@backstage/plugin-kubernetes-backend": "^0.18.6",
"@janus-idp/backstage-plugin-topology": "^1.28.0"
},
"jest": {
"transformModules": [
"@asyncapi/react-component"
]
},
"files": [
"dist-dynamic/*.*",
"dist-dynamic/dist/**",
"dist-dynamic/alpha/*"
]
"packageManager": "[email protected]"
}
Loading

0 comments on commit ea18cb6

Please sign in to comment.