Skip to content

Cluster node status frontend #9009

Cluster node status frontend

Cluster node status frontend #9009

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
release:
types: [published]
workflow_dispatch:
repository_dispatch:
types: [start-ci, deploy-demo]
env:
ELIXIR_VERSION: 1.15.7
OTP_VERSION: 26
MIX_ENV: test
NODE_VERSION: "16"
jobs:
elixir-deps:
name: Elixir dependencies (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.15.7
otp: 26
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
env:
ImageOS: ubuntu20
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
npm-deps:
name: Npm dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install NPM dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: cd assets && npm install
codespell:
name: Check common misspellings
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install codespell
run: |
sudo apt-get install -y git python3 python3-pip
python3 -m pip install codespell
- name: codespell
run: codespell -S priv*,*package*json,deps*,*node_modules*,*svg,*.git,*.app -L enque,daa
generate-docs:
name: Generate project documentation
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.ref_name == 'main'
steps:
- uses: actions/checkout@v4
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Build docs
uses: lee-dohm/generate-elixir-docs@v1
- name: Generate openapi.json
run: mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.V1.ApiSpec
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: ./doc/swaggerui
spec-file: openapi.json
- name: Publish to Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
static-code-analysis:
name: Static Code Analysis
needs: [elixir-deps, npm-deps, api-bc-check]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Elixir Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Check for unused dependencies
run: mix deps.unlock --check-unused
- name: Check Code Format
run: mix format --check-formatted
- name: Run Credo
run: mix credo
- name: Run Dialyzer
run: mix dialyzer
- name: Run Eslint
run: cd assets && npm run lint
- name: Check JS Code Format
run: cd assets && npm run format:check
test-fe:
name: Run FE tests
needs: npm-deps
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Run JS tests
run: cd assets && npm test
test:
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
needs: [elixir-deps, api-bc-check]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.15.7
otp: 26
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Compile
run: mix compile --warnings-as-errors
- name: "Docker compose dependencies"
uses: isbang/compose-action@v1.5.1
with:
compose-file: "./docker-compose.yaml"
down-flags: "--volumes"
- name: Run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix coveralls.github --warnings-as-errors --trace
chromatic:
name: Chromatic deployment
needs: [elixir-deps, npm-deps]
runs-on: ubuntu-20.04
if: github.event_name != 'repository_dispatch'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Build CSS
run: npx tailwindcss --input=css/app.css --output=../priv/static/assets/app.css --postcss
working-directory: assets
- name: Build Frontend
run: npm run build
working-directory: assets
- name: Publish to Chromatic
uses: chromaui/action@v10
with:
workingDir: assets
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: true
skip: dependabot/**
npm-e2e-deps:
name: Npm E2E dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: npm-e2e-cache
with:
path: |
test/e2e/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('test/e2e/package-lock.json') }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install E2E NPM dependencies
if: steps.npm-e2e-cache.outputs.cache-hit != 'true'
run: cd test/e2e && npm install
test-e2e:
name: End to end tests
needs: [elixir-deps, npm-deps, npm-e2e-deps, api-bc-check]
runs-on: ubuntu-20.04
env:
MIX_ENV: dev
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
deps
_build/dev
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Retrieve E2E NPM Cached Dependencies
uses: actions/cache@v4
id: npm-e2e-cache
with:
path: |
test/e2e/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('test/e2e/package-lock.json') }}
- name: Check Eslint and JS Code Format
run: cd test/e2e && npm run lint && npm run format:check
- name: "Docker compose dependencies"
uses: isbang/compose-action@v1.5.1
with:
compose-file: "./docker-compose.yaml"
down-flags: "--volumes"
- name: Mix setup
run: mix setup
- name: Run trento detached
run: mix phx.server &
- name: Install photofinish
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: trento-project/photofinish
tag: v1.2.2
cache: enable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Give executable permissions to photofinish
run: chmod +x $(whereis photofinish | cut -d" " -f2)
- name: Cypress run
uses: cypress-io/github-action@v6
env:
cypress_video: false
cypress_db_host: postgres
cypress_db_port: 5432
cypress_photofinish_binary: $(whereis photofinish | cut -d" " -f2)
with:
working-directory: test/e2e
wait-on-timeout: 30
config: baseUrl=http://localhost:4000
- name: Upload cypress test screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-screenshots
path: test/e2e/cypress/screenshots/
main-branch-deps:
name: Rebuild main branch dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
if: github.ref_name != 'main'
with:
access_token: ${{ github.token }}
- name: Set up Elixir
uses: erlef/setup-beam@v1
if: github.ref_name != 'main'
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Checkout main branch
uses: actions/checkout@v4
if: github.ref_name != 'main'
with:
ref: main
- name: Retrieve Cached Dependencies - main branch
uses: actions/cache@v4
id: mix-cache-main
if: github.ref_name != 'main'
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Install missing dependencies
if: steps.mix-cache-main.outputs.cache-hit != 'true' && github.ref_name != 'main'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
api-bc-check:
name: API bc check
needs: [elixir-deps, main-branch-deps]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- version: V1
- version: V2
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Checkout current branch
uses: actions/checkout@v4
- name: Retrieve Cached Dependencies - current branch
uses: actions/cache@v4
id: mix-cache-current
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Generate current openapi.json
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/current-spec.json
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Retrieve Cached Dependencies - main branch
uses: actions/cache@v4
id: mix-cache-main
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Generate main openapi.json
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/main-spec.json
- name: Locate generated specs
run: mv /tmp/specs .
- name: Find difference between OpenAPI specifications
run: |
docker run -v "$(pwd)/specs:/specs" --rm openapitools/openapi-diff:2.0.1 \
/specs/main-spec.json \
/specs/current-spec.json \
--fail-on-incompatible \
--markdown /specs/changes.md \
--text /specs/changes.txt \
--html /specs/changes.html
- name: Upload OpenAPI diff report
uses: actions/upload-artifact@v4
if: failure()
with:
name: openapi-diff-report-${{ matrix.version }}
path: specs/
build-and-push-container-images:
name: Build and push container images
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe, test-e2e]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/trento-web
IMAGE_TAG: "${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'push' && github.ref_name == 'main' && 'rolling') || github.sha }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-demo-img:
name: Build the docker image for the demo environment
runs-on: ubuntu-latest
if: github.event.action == 'deploy-demo' || github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe]
permissions:
contents: read
packages: write
env:
MIX_ENV: demo
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/trento-web
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:demo
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: MIX_ENV=demo
deploy-demo-env:
name: Deploy updated images to the demo environment
runs-on: self-hosted
if: |
vars.DEPLOY_DEMO == 'true' &&
(
github.event_name == 'release' ||
github.event.action == 'deploy-demo' ||
(github.event_name == 'push' && github.ref_name == 'main') ||
github.event_name == 'workflow_dispatch'
)
env:
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}
needs: [build-demo-img, test-e2e]
steps:
- name: Start a local k8s cluster
uses: jupyterhub/action-k3s-helm@v4
with:
k3s-channel: latest
- name: Add bitnami helm deps
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Download and unzip helm chart
run: |
rm rolling.zip | true
rm -rf helm-charts-rolling | true
wget https://github.com/trento-project/helm-charts/archive/refs/tags/rolling.zip
unzip rolling.zip
- name: Install trento-server helm chart
run: |
cd helm-charts-rolling/charts/trento-server
helm dependency update
helm upgrade -i trento --wait . \
--set trento-web.adminUser.password="${{ secrets.DEMO_PASSWORD }}" \
--set trento-web.image.pullPolicy=Always \
--set trento-web.image.repository="${IMAGE_REPOSITORY}/trento-web" \
--set trento-web.image.tag="demo" \
--set trento-wanda.image.pullPolicy=Always \
--set trento-wanda.image.repository="${IMAGE_REPOSITORY}/trento-wanda" \
--set trento-wanda.image.tag="demo"
run-photofinish-demo-env:
name: Use photofinish to push mock data to the demo environment
runs-on: ubuntu-20.04
if: |
vars.DEPLOY_DEMO == 'true' &&
(
github.event_name == 'release' ||
github.event.action == 'deploy-demo' ||
(github.event_name == 'push' && github.ref_name == 'main') ||
github.event_name == 'workflow_dispatch'
)
needs: deploy-demo-env
env:
TRENTO_DEMO_IP: ${{ secrets.TRENTO_DEMO_IP }}
TRENTO_API_KEY: ${{ secrets.TRENTO_API_KEY }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install photofinish
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
repo: trento-project/photofinish
tag: v1.2.2
cache: enable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Give executable permissions to photofinish
run: chmod +x $(whereis photofinish | cut -d" " -f2)
- name: Push data
run: |
photofinish run healthy-27-node-SAP-cluster -u "http://$TRENTO_DEMO_IP/api/collect" "$TRENTO_API_KEY"
photofinish run hana-scale-out -u "http://$TRENTO_DEMO_IP/api/collect" "$TRENTO_API_KEY"
photofinish run hana-diskless-sbd -u "http://$TRENTO_DEMO_IP/api/collect" "$TRENTO_API_KEY"
obs-commit-image:
name: Commit to OBS to generate container image
runs-on: ubuntu-20.04
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe, test-e2e]
container:
image: ghcr.io/trento-project/continuous-delivery:main
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEST_FOLDER: "/tmp/osc_project"
NAME: trento-web-image
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
FOLDER: packaging/suse/container
REPOSITORY: ${{ github.repository }}
options: -u 0:0
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
- uses: actions-ecosystem/action-get-latest-tag@v1
id: latest-tag
with:
semver_only: true
initial_version: 0.0.1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install assets
run: cd assets && npm install
- name: Get mix deps
run: mix local.hex --force && mix deps.clean --all && mix deps.get
- name: Configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- name: Prepare .changes file
# The .changes file is updated only in release creation. This current task should be improved
# in order to add the current rolling release notes
if: github.event_name == 'release'
run: |
CHANGES_FILE=$NAME.changes
osc checkout $OBS_PROJECT $NAME $CHANGES_FILE
mv $CHANGES_FILE $FOLDER
VERSION=${{ steps.latest-tag.outputs.tag }}
hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $VERSION -f $FOLDER/$CHANGES_FILE
- name: Set version
run: |
git config --global --add safe.directory /__w/web/web
VERSION=$(./hack/get_version_from_git.sh)
# "+" character is not allowed in OBS dockerfile version strings
VERSION=${VERSION//[+]/-}
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/Dockerfile
- name: Commit on OBS
run: |
OBS_PACKAGE=$OBS_PROJECT/$NAME
osc checkout $OBS_PACKAGE -o $DEST_FOLDER
cp -r $FOLDER/* $DEST_FOLDER
tar --transform 's,^./,/web/,' -zcvf $DEST_FOLDER/web.tar.gz --exclude=./.git ./*
cd $DEST_FOLDER
osc ar
osc commit -m "New development version of $NAME released"
obs-commit-rpm:
name: Commit to OBS to generate RPM package
needs: [static-code-analysis, test, test-fe, test-e2e]
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
container:
image: ghcr.io/trento-project/continuous-delivery:main
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
OSC_CHECKOUT_DIR: /tmp/trento-web-package
REPOSITORY: ${{ github.repository }}
FOLDER: packaging/suse/rpm
options: -u 0:0
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- name: Prepare _service file
run: |
git config --global --add safe.directory /__w/web/web
VERSION=$(./hack/get_version_from_git.sh)
sed -i 's~%%REVISION%%~${{ github.sha }}~' $FOLDER/_service && \
sed -i 's~%%REPOSITORY%%~'"${REPOSITORY}"'~' $FOLDER/_service && \
sed -i 's~%%VERSION%%~'"${VERSION}"'~' $FOLDER/_service
- name: Get mix deps & prepare tarball
run: |
mix local.hex --force && mix deps.clean --all && mix deps.get
tar -c deps | gzip -n > deps.tar.gz
- name: Checkout and prepare OBS package
run: |
osc checkout $OBS_PROJECT trento-web -o $OSC_CHECKOUT_DIR
cp $FOLDER/_service $OSC_CHECKOUT_DIR
cp $FOLDER/trento-web.spec $OSC_CHECKOUT_DIR
rm -vf $OSC_CHECKOUT_DIR/*.tar.gz
pushd $OSC_CHECKOUT_DIR
osc service manualrun
rm -vf $OSC_CHECKOUT_DIR/*.tgz
cp /__w/web/web/deps.tar.gz .
- name: Prepare trento-web.changes file
# The .changes file is updated only in release creation. This current task should be improved
# in order to add the current rolling release notes
if: github.event_name == 'release'
run: |
git config --global --add safe.directory /__w/web/web
VERSION=$(./hack/get_version_from_git.sh)
TAG=$(echo $VERSION | cut -f1 -d+)
hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $TAG -f $OSC_CHECKOUT_DIR/trento-web.changes
- name: Commit changes into OBS
run: |
pushd $OSC_CHECKOUT_DIR
osc ar
osc commit -m "GitHub Actions automated update to reference ${{ github.sha }}"