Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
Always build landing-page container from sources & remove Dockerfile.local.

Update vsix and the package-lock of the node/monitor package.

Add paths to run the service tests.

Make sure last next tag points to release.

Create reuseable workflow for manually publishing demo applications.

Set Node version to 16.14.0 instead of 16.x.

Improve README.

Contributed on behalf of STMicroelectronics
  • Loading branch information
sgraband committed Dec 8, 2023
1 parent d7fa70a commit 750b762
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-landing-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
docker_org: theiacloud
docker_image: theia-cloud-landing-page
docker_file: dockerfiles/landing-page/Dockerfile.local
docker_file: dockerfiles/landing-page/Dockerfile
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
62 changes: 62 additions & 0 deletions .github/workflows/publish-demos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Demos CI

on:
workflow_dispatch:
inputs:
publish_type:
description: "Which build to trigger"
required: true
default: "next"
type: choice
options:
- next
- latest
publish_theia_cloud_demo:
description: "Should theia-cloud-demo be published"
type: boolean
required: true
publish_theia_cloud_activity_demo_theia:
description: "Should theia-cloud-activity-demo-theia be published"
type: boolean
required: true
publish_theia_cloud_activity_demo:
description: "Should theia-cloud-activity-demo be published"
type: boolean
required: true

jobs:
publish-theia-cloud-demo:
if: ${{ inputs.publish_theia_cloud_demo }} == true
uses: ./.github/workflows/reusable-demo.yml
with:
docker_org: theiacloud
docker_image: theia-cloud-demo
docker_file: demo/dockerfiles/demo-theia-docker/Dockerfile
publish_type: ${{ inputs.publish_type }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

publish-theia-cloud-activity-demo-theia:
if: ${{ inputs.publish_theia_cloud_activity_demo_theia }} == true
uses: ./.github/workflows/reusable-demo.yml
with:
docker_org: theiacloud
docker_image: theia-cloud-activity-demo-theia
docker_file: demo/dockerfiles/demo-theia-monitor-theia/Dockerfile
publish_type: ${{ inputs.publish_type }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

publish-theia-cloud-activity-demo:
if: ${{ inputs.publish_theia_cloud_activity_demo }} == true
uses: ./.github/workflows/reusable-demo.yml
with:
docker_org: theiacloud
docker_image: theia-cloud-activity-demo
docker_file: demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile
publish_type: ${{ inputs.publish_type }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
91 changes: 91 additions & 0 deletions .github/workflows/reusable-demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Reusable workflow publishing demo applications

on:
workflow_call:
inputs:
docker_org:
required: true
type: string
docker_image:
required: true
type: string
docker_file:
required: true
type: string
publish_type:
description: "Pubish as latest ('latest') or next ('next')"
required: true
type: string
secrets:
dockerhub_username:
required: true
dockerhub_token:
required: true

env:
VERSION: 0.9.0-next

jobs:
publish-next:
runs-on: ubuntu-latest
if: ${{ inputs.publish_type }} == 'next'

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create docker tags
id: get_tags
run: |
echo "sha_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}.$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT
echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT
- name: Build Docker image
run: docker build -t ${{ steps.get_tags.outputs.version_tag }} -f ${{ inputs.docker_file }} .

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}

# Push version and SHA tag for main pushes of next versions (This avoids duplicate pushes for release commits on main)
- name: Push version and SHA tag
if: endsWith(env.VERSION, '-next')
run: |
docker push ${{ steps.get_tags.outputs.version_tag }}
docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.sha_tag }}
docker push ${{ steps.get_tags.outputs.sha_tag }}
publish-latest:
runs-on: ubuntu-latest
if: ${{ inputs.publish_type }} == 'latest'

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Create docker tags
id: get_tags
run: |
echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "next_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}-next" >> $GITHUB_OUTPUT
echo "latest_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:latest" >> $GITHUB_OUTPUT
- name: Build Docker image
run: docker build -t ${{ steps.get_tags.outputs.version_tag }} -f ${{ inputs.docker_file }} .

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}

# Push version, next and latest tag for releases (version should be valid semver)
- name: Push version and latest tag
run: |
docker push ${{ steps.get_tags.outputs.version_tag }}
docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.latest_tag }}
docker push ${{ steps.get_tags.outputs.latest_tag }}
docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.next_tag }}
docker push ${{ steps.get_tags.outputs.next_tag }}
5 changes: 4 additions & 1 deletion .github/workflows/reusable-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
id: get_tags
run: |
echo "version_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo "next_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:${{ env.VERSION }}-next" >> $GITHUB_OUTPUT
echo "latest_tag=${{ inputs.docker_org }}/${{ inputs.docker_image }}:latest" >> $GITHUB_OUTPUT
- name: Build Docker image
Expand All @@ -93,9 +94,11 @@ jobs:
username: ${{ secrets.dockerhub_username }}
password: ${{ secrets.dockerhub_token }}

# Push version and latest tag for releases (version should be valid semver)
# Push version, next and latest tag for releases (version should be valid semver)
- name: Push version and latest tag
run: |
docker push ${{ steps.get_tags.outputs.version_tag }}
docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.latest_tag }}
docker push ${{ steps.get_tags.outputs.latest_tag }}
docker tag ${{ steps.get_tags.outputs.version_tag }} ${{ steps.get_tags.outputs.next_tag }}
docker push ${{ steps.get_tags.outputs.next_tag }}
6 changes: 3 additions & 3 deletions .github/workflows/reusable-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "16.14.0"

- name: Install dependencies
run: npm ci
Expand All @@ -45,7 +45,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "16.14.0"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
Expand All @@ -69,7 +69,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: "16.x"
node-version: "16.14.0"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ on:
push:
branches:
- main
paths:
- "java/common/**"
- "java/service/**"
pull_request:
branches:
- main
paths:
- "java/common/**"
- "java/service/**"

jobs:
tests:
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,23 @@ This means, that those dependencies will be updated to newer version, once they

New release every three months.

Make a commit were the next parts are removed from the `versions` across the repo (For consumed Theia Cloud npm dependencies, e.g. @eclipse-theiacloud/common, needs to be changed from `next` to the desired version).
To make a release provide a commit that:

- removes the next parts from `version` fields across the repo.
- updates the package-lock files.
- updates the `node/monitor` .vsix file in `demo/dockerfiles/demo-theia-monitor-vscode`.
- updates the helm chart versions in `terraform/modules/helm` to the new version.

When this commit is merged it should not result in pushed artifacts.
Create a `releases/<currentVersion>` branch. This will be used in the future if any backports are necessary. Also it makes versions easier to find.
Then create a Github release pointing to the commit. This will then publish the artifacts for the specific version and also set the version to latest.

The next commit after a Release should then:

- readd the next parts from `version` fields across the repo.
- update the package-lock files.
- update the `node/monitor` .vsix file in `demo/dockerfiles/demo-theia-monitor-vscode`.

## Building

All components are deployed as docker images and may be built with docker. See [Building.md](doc/docs/Building.md) for more information. We offer prebuilt images ready to use.
Expand Down
2 changes: 1 addition & 1 deletion demo/dockerfiles/demo-theia-monitor-vscode/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM theiacloud/theia-cloud-demo:0.9.0-next as production-stage

COPY --chown=theia:theia theiacloud-monitor-0.9.0.vsix /home/theia/applications/browser/plugins
COPY --chown=theia:theia theiacloud-monitor-0.9.0-next.vsix /home/theia/applications/browser/plugins
Binary file not shown.
Binary file not shown.
12 changes: 9 additions & 3 deletions dockerfiles/landing-page/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# This docker file build uses the local common package

# build stage
FROM node:16-alpine as build-stage
WORKDIR /app
COPY node/common/src ./common/src
COPY node/common/package.json node/common/tsconfig.json ./common/
COPY node/configs ./configs/
COPY node/tsconfig.json node/package*.json ./
COPY node/landing-page/. ./landing-page/
RUN npm ci

RUN npm ci && npm run build -w common

RUN npm run build:nolint -w landing-page

# production stage
FROM nginx:stable-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY --from=build-stage /app/landing-page/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]
20 changes: 0 additions & 20 deletions dockerfiles/landing-page/Dockerfile.local

This file was deleted.

4 changes: 2 additions & 2 deletions node/monitor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 750b762

Please sign in to comment.