Skip to content
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

Initial v2 #1

Merged
merged 1 commit into from
Feb 18, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "@patternfly/*"
dependency-type: "direct"
- dependency-name: "@cypress/*"
dependency-type: "direct"
- dependency-name: "cypress*"
dependency-type: "direct"
11 changes: 11 additions & 0 deletions .github/scripts/issue_create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
echo $GH_ISSUE_TITLE
echo $NUMBER
echo $DESCRIPTION
echo $REPOSITORY
JIRA_ISSUE_ID=$(echo $GH_ISSUE_TITLE|cut -d] -f1|sed 's/[[]//g')
TITLE=$(echo $GH_ISSUE_TITLE|cut -d] -f2)
echo $JIRA_ISSUE_ID
echo $TITLE
PAYLOAD="{ \"fields\": { \"project\": { \"key\": \"TACKLE\" }, \"parent\": { \"key\": \"$JIRA_ISSUE_ID\" }, \"summary\": \"[$REPOSITORY#"$NUMBER"]$TITLE\", \"description\": \"$DESCRIPTION\", \"issuetype\": { \"id\": 5 } } }"
echo $PAYLOAD
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic "$BEARER -d "$PAYLOAD" https://issues.redhat.com/rest/api/2/issue/
8 changes: 8 additions & 0 deletions .github/scripts/issue_transaction.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo $GH_ISSUE_TITLE
echo $NUMBER
echo $REPOSITORY
JIRA_ISSUE_ID=$(echo $GH_ISSUE_TITLE|cut -d] -f1|sed 's/[[]//g')
echo $JIRA_ISSUE_ID
JIRA_SUBTASK_ID=$(curl -X GET -H "Content-Type: application/json" -H "Authorization: Basic "$BEARER https://issues.redhat.com/rest/api/2/issue/$JIRA_ISSUE_ID|jq --raw-output '.fields.subtasks[] | select(.fields.summary | startswith("['$REPOSITORY'#'$NUMBER']")).key')
echo $JIRA_SUBTASK_ID
curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic "$BEARER https://issues.redhat.com/rest/api/2/issue/$JIRA_SUBTASK_ID/transitions -d "{\"transition\":{\"id\":$1}}"
34 changes: 34 additions & 0 deletions .github/workflows/ci-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
unit-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Build
working-directory: pkg/client
run:
npm install
npm run build
- name: Test
working-directory: pkg/client
run:
npm run test:unit --coverage --watchAll=false
- uses: codecov/codecov-action@v1
with:
flags: unitests
55 changes: 55 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tackle UI Issues Sync

defaults:
run:
shell: bash
working-directory: .github/scripts/

on:
issues:
types: [opened, closed, reopened]

jobs:

sync-opened:
runs-on: ubuntu-latest
if: ${{ github.event.action == 'opened' && startsWith(github.event.issue.title, '[TACKLE2-') }}
name: New GitHub Issue to sync with Jira
steps:
- uses: actions/checkout@v2.3.4
- env:
BEARER: ${{ secrets.JIRA_TACKLE_BEARER }}
GH_ISSUE_TITLE: ${{ github.event.issue.title }}
NUMBER: ${{ github.event.issue.number }}
DESCRIPTION: ${{ github.event.issue.html_url }}
REPOSITORY: ${{ github.event.repository.name }}
run: |
./issue_create.sh

sync-reopened:
runs-on: ubuntu-latest
if: ${{ github.event.action == 'reopened' && startsWith(github.event.issue.title, '[TACKLE2-') }}
name: Reopened GitHub Issue to sync with Jira
steps:
- uses: actions/checkout@v2.3.4
- env:
BEARER: ${{ secrets.JIRA_TACKLE_BEARER }}
GH_ISSUE_TITLE: ${{ github.event.issue.title }}
NUMBER: ${{ github.event.issue.number }}
REPOSITORY: ${{ github.event.repository.name }}
run: |
./issue_transaction.sh 3

sync-closed:
runs-on: ubuntu-latest
if: ${{ github.event.action == 'closed' && startsWith(github.event.issue.title, '[TACKLE2-') }}
name: Closed GitHub Issue to sync with Jira
steps:
- uses: actions/checkout@v2.3.4
- env:
BEARER: ${{ secrets.JIRA_TACKLE_BEARER }}
GH_ISSUE_TITLE: ${{ github.event.issue.title }}
NUMBER: ${{ github.event.issue.number }}
REPOSITORY: ${{ github.event.repository.name }}
run: |
./issue_transaction.sh 2
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/pkg/**/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/pkg/client/dist
/pkg/qa-tests/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*

.eslintcache

# cypress
/pkg/cypress/videos
/pkg/cypress/screenshots
.nyc_output

# VSCode
.vscode/*

# Intellij IDEA
.idea/
2 changes: 2 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @konveyor/migration-engineering-ui-committers
/pkg/qe-tests/ @konveyor/migration-engineering-qe-committers
84 changes: 84 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Dev environment

Note - The steps described below are executed on a Fedora 35 workstation, but will likely work on any recent Linux distribution. The only prerequisites are to enable virtualization extensions in the BIOS/EFI of the machine, to install libvirt and to add our user to the libvirt group.

The first thing to do is to install Minikube, which provides a certified Kubernetes platform with most of the vanilla features. This allows to simulate a real Kubernetes cluster with a fairly high level of feature parity.

## Installing Minikube
The installation consists in downloading the minikube binary into ${HOME}/.local/bin, so that we don't need to modify the PATH variable. Other options are described in Minikube documentation.

```
$ curl -sL -o ${HOME}/.local/bin/minikube \
https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
$ chmod u+x ~/.local/bin/minikube
```

Add ${HOME}/.local/bin to your PATH environment variable

By default, Minikube uses the kvm driver with 6,000 MB of memory. This is not enough to run all the services, so we need to increase the allocated memory. In our experience, 10 GB of memory is fine.

`$ minikube config set memory 10240`

Then, the following command will download a qcow2 image of Minikube and start a virtual machine from it. It will then wait for the Kubernetes API to be ready.

`$ minikube start`

We need to enable the dashboard, ingress and olm addons. The dashboard addon installs the dashboard service that exposes the Kubernetes objects in a user interface. The ingress addon allows us to create Ingress CRs to expose the Tackle UI and Tackle Hub API. The olm addon allows us to use an operator to deploy Tackle.

`$ minikube addons enable dashboard`
`$ minikube addons enable ingress`
`$ minikube addons enable olm`


The following command gives us the IP address assigned to the virtual machine created by Minikube. It will be used later, when interacting with the Tackle Hub API.

```
$ minikube ip
192.168.39.23
```

## Configuring kubectl (optional)
Minikube allows us to use the kubectl command with `minikube kubectl. To make the experience more Kubernetes-like, we can set a shell alias to simply use kubectl. The following example shows how to do it for Bash on Fedora 35.

```
$ mkdir -p ~/.bashrc.d
$ cat << EOF > ~/.bashrc.d/minikube
alias kubectl="minikube kubectl --"
EOF
$ source ~/.bashrc
```

## Accessing the Kubernetes dashboard
We may need to access the dashboard, either simply to see what's happening under the hood, or to troubleshoot an issue. We have already enabled the dashboard addon in a previous command.

We can use the kubectl proxy command to enable that. The following command sets up the proxy to listen on any network interface (useful for remote access), on the 18080/tcp port (easy to remember), with requests filtering disabled (less secure, but necessary).

`$ kubectl proxy --address=0.0.0.0 --port 18080 --disable-filter=true`

We can now access the dashboard through the proxy.
In the following URL, replace the IP address with your workstation IP address.

http://192.168.0.1:18080/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/


## Installing Tackle
We can now deploy Tackle using the Ansible based operator. It is currently not published, so we'll have to use the deploy target of the Makefile provided in the repository.

```
$ git clone https://github.com/fabiendupont/tackle-operator
$ cd tackle-operator
$ make deploy
```

This only deploys the controller-manager pod, we need to create a Tackle CR to trigger the deployment of the other services. An example is provided in the repository.

`$ kubectl create -f config/samples/tackle.konveyor.io_v1alpha1_tackle.yaml`

## Set-up kubectl to forward each api services to localhost
In separate windows run each of the following:

`$ kubectl port-forward svc/tackle-keycloak-sso -n tackle-operator 9001:8080`

`$ kubectl port-forward svc/tackle-hub-api -n tackle-operator 9002:8080`

`$ kubectl port-forward svc/tackle-pathfinder-api -n tackle-operator 9003:8080`
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Builder image
FROM registry.access.redhat.com/ubi8/nodejs-16 as builder
COPY pkg/client/dist/ ./client/dist/
COPY pkg/server ./server/
COPY entrypoint.sh .
RUN cd ./server && npm install

# Runner image
FROM registry.access.redhat.com/ubi8/nodejs-16-minimal

# Add ps package to allow liveness probe for k8s cluster
# Add tar package to allow copying files with kubectl scp
USER 0
RUN microdnf -y install tar procps-ng && microdnf clean all

USER 1001

LABEL name="konveyor/tackle-ui" \
description="Konveyor for Tackle - User Interface" \
help="For more information visit https://konveyor.io" \
license="Apache License 2.0" \
maintainer="gdubreui@redhat.com,ibolton@redhat.com" \
summary="Konveyor for Tackle - User Interface" \
url="https://quay.io/gildub/tackle2-ui" \
usage="podman run -p 80 -v konveyor/tackle2-ui:latest" \
com.redhat.component="konveyor-tackle2-ui-container" \
io.k8s.display-name="tackle2-ui" \
io.k8s.description="Konveyor for Tackle - User Interface" \
io.openshift.expose-services="80:http" \
io.openshift.tags="operator,konveyor,ui,nodejs16" \
io.openshift.min-cpu="100m" \
io.openshift.min-memory="350Mi"

COPY --from=builder /opt/app-root/src /opt/app-root/src
COPY --from=builder /opt/app-root/src/entrypoint.sh /usr/bin/entrypoint.sh

ENV DEBUG=1

ENTRYPOINT ["/usr/bin/entrypoint.sh"]
48 changes: 48 additions & 0 deletions INTERNATIONALIZATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Internationalization

To translate Tackle UI into a new language you only need to create a new file `public/locales/{myLanguageCode}/translation.json`. Where `myLanguageCode` can be any `ISO 639-1` code value.

## How to add a new language

Steps:

- Clone this repository.
- Locate your terminal in the cloned repository and execute:

```
npm install
```

- Edit the file `i18next-parser.config.js` and add your new language code to the array `locales`. E.g.

```
locales: ["en", "es", "myLanguageCode"]
```

- Generate the folder and files for the new language:

```
npm extract
```

The previous command created a file `public/locales/{myLanguageCode}/translation.json`; the content of this file should be the translated new language. As a reference you can use the english version of the translation located at [public/locales/en/translation.json](https://github.com/konveyor/tackle-ui/blob/main/public/locales/en/translation.json)

> As soon as you feel confident, please open a new Pull Request with your changes and make it part of the official repository.

## How to see the new translation in action?

To see your changes in action you will need to start Tackle UI in development mode. For starting Tackle UI in development mode please follow the instruction at [Starting the UI](https://github.com/konveyor/tackle-ui#starting-the-ui)

Steps:

- Start Tackle UI in dev mode following [Starting the UI](https://github.com/konveyor/tackle-ui#starting-the-ui) instructions.
- Go to Keycloak http://localhost:8180/auth/admin/ and use `username=admin, password=admin`. Go to `Realm settings > themes > Supported locales` and select the new language you are adding. Finally click on `Save`.
- Go to http://localhost:3000/ and you should be redirected to the Login page where you are able to select your new language.

At this point you should be able to see your new language already translated into the language you selected in the Login phase.

> Remember that since you are in dev mode any change you do to the folder `public/locales` should be automatically loaded in your browser.

## Why the questionnaire (assessment process) is not translated?

The questionnaire is data comming from https://github.com/konveyor/tackle-pathfinder hence the translation to a new language of the questionnaire should be done in that repository.
Loading