Skip to content

Commit

Permalink
Migrates the entire code-base to @openshift-assisted/types
Browse files Browse the repository at this point in the history
- The commit adds a basic client for AMS, used to retrieve the pull-secret.
- CI workflow adjusted in order to pick up automatically the workspaces that are meant to be published to NPM.
- Release docs updated as well
  • Loading branch information
jkilzi committed Aug 9, 2023
1 parent 9b345ce commit 7f4b62a
Show file tree
Hide file tree
Showing 257 changed files with 697 additions and 10,659 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ jobs:
echo "Expecting to be in a release branch, but we are in: ${{ github.event.release.target_commitish }}"
exit 1
fi
- uses: actions/checkout@v3
with:
token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }}
ref: ${{ github.event.release.target_commitish }}
fetch-depth: 0

- name: Lookup for workspaces to be published
run: |
declare -a workspaces=()
for pkg in `ls -1 libs/*/package.json`; do
if [[ "$(jq '.publishConfig.access == "public"' ${pkg})" == "true" ]]; then
workspaces+=("${pkg:5:-13}")
fi
done
(IFS=,; printf 'The following workspaces will be published: [%s]' "${workspaces[*]}")
echo "WORKSPACES=${workspaces}" >> $GITHUB_ENV
- name: Configuring git
run: |
git config user.name '${{ github.actor }}'
Expand All @@ -39,8 +51,7 @@ jobs:

- name: Bump workspaces to ${{ github.ref_name }}
run: |
workspaces=(ui-lib locales)
for ws in "${workspaces[@]}"; do
for ws in "${WORKSPACES[@]}"; do
yarn workspace @openshift-assisted/${ws} version ${GITHUB_REF_NAME:1}
# The above command adds a `stableVersion` field after bumping. Removing it as it's buggy.
# See: https://github.com/yarnpkg/berry/issues/4328
Expand All @@ -55,10 +66,13 @@ jobs:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
yarn config set npmScopes.openshift-assisted.npmAuthToken $NPM_AUTH_TOKEN
yarn workspace @openshift-assisted/ui-lib npm publish
# Sleep ${{ vars.NPM_PUBLISH_DELAY }} in order to give time for processing the previously published package.
sleep ${{ vars.NPM_PUBLISH_DELAY }}
yarn workspace @openshift-assisted/locales npm publish
for ws in "${WORKSPACES[@]}"; do
yarn workspace @openshift-assisted/${ws} npm publish
# Verify the package has been published before publishing another one.
until yarn info @openshift-assisted/${ws} &> /dev/null; do
sleep ${{ vars.NPM_PUBLISH_DELAY }}
done
done
- name: Update the repo
run: |
Expand Down
10 changes: 2 additions & 8 deletions apps/assisted-ui/src/components/App/components/AboutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@ import {
} from '@patternfly/react-core';
import { GIT_SHA, VERSION, SERVICE_LABELS, IMAGE_REPO } from '../../../config';
import redHatLogo from '../../../images/Logo-Red_Hat-OpenShift_Container_Platform-B-Reverse-RGB.png';
import {
Services,
Api,
Constants,
DetailList,
DetailItem,
ListVersions,
} from '@openshift-assisted/ui-lib/ocm';
import { Services, Api, Constants, DetailList, DetailItem } from '@openshift-assisted/ui-lib/ocm';
import { ListVersions } from '@openshift-assisted/types/assisted-installer-service';

export const AboutModalButton: React.FC = () => {
const [isModalOpen, setIsModalOpen] = useState(false);
Expand Down
44 changes: 33 additions & 11 deletions docs/RELEASE_WORKFLOW.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
# Release workflow (maintainers only)
# Release workflow

Releasing a new version involves publishing the following packages to npmjs.com and creating a
Releasing a new version involves publishing packages to the NPM public registry and creating a
container image containing a stand-alone version of the UI app (see
[apps/assisted-ui](https://github.com/openshift-assisted/assisted-installer-ui/tree/master/apps/assisted-ui)):
[apps/assisted-ui](https://github.com/openshift-assisted/assisted-installer-ui/tree/master/apps/assisted-ui)).
The [release.yaml](../.github/workflows/release.yaml) workflow contains the scripts for producing
and publishing the final artifacts.

## How JS libraries are selected for publishing by the CI

The library's `package.json` must contain the following section in order to be selected by the CI.

```json
{
"publishConfig": {
"access": "public"
}
}
```

## Instructions

1. Make sure you have been granted the `maintaner` role in the project settings.
2. Create a new branch from `master` and name it following this pattern:
`releases/v<some-semver-string>`.
3. [Draft a new release through GitHub's interface](https://github.com/openshift-assisted/assisted-installer-ui/releases/new).
4. Fill the form with the following details:
1. Tag: `v<some-semver-string>`
2. Target branch: `releases/v<some-semver-string>` (the same as in the previous step).
3. Title: `v<some-semver-string>` (again, the same as in the previous step).
4. Description: Generate the release notes automatically (recommended), or edit the field
manually.

## List of publicly available artifacts

- [@openshift-assisted/ui-lib](https://www.npmjs.com/package/@openshift-assisted/ui-lib)
- [@openshift-assisted/types](https://www.npmjs.com/package/@openshift-assisted/types)
- [@openshift-assisted/locales](https://www.npmjs.com/package/@openshift-assisted/locales)
- https://quay.io/repository/edge-infrastructure/assisted-installer-ui?tab=tags

1. Create a new branch from `master` in this repo, called `release/v<some-semver-string>`.
2. [Draft a new release through GitHub's interface](https://github.com/openshift-assisted/assisted-installer-ui/releases/new).
3. Fill the form with the following details:
1. Tag: `v<some-semver-string>`
2. Target branch: `release/v<some-semver-string>` (same as in step 2 above).
3. Title: `v<some-semver-string>`
4. Description: Generate the release notes automatically (or edit the field manually)
6 changes: 4 additions & 2 deletions libs/locales/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"./en/translation.json": "./lib/en/translation.json",
"./ja/translation.json": "./lib/ja/translation.json",
"./ko/translation.json": "./lib/ko/translation.json",
"./zh/translation.json": "./lib/zh/translation.json"
"./zh/translation.json": "./lib/zh/translation.json",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
Expand All @@ -27,7 +28,8 @@
}
},
"files": [
"lib"
"lib",
"tsconfig.json"
],
"license": "Apache-2.0",
"name": "@openshift-assisted/locales",
Expand Down
5 changes: 1 addition & 4 deletions libs/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
],
"type": "module",
"name": "@openshift-assisted/toolbox",
"publishConfig": {
"access": "public"
},
"private": true,
"repository": {
"directory": "libs/toolbox",
"type": "git",
Expand All @@ -31,5 +27,6 @@
"check_types": "yarn run -T tsc --noEmit",
"clean": "yarn run -T rimraf build node_modules"
},
"private": true,
"version": "1.0.0"
}
30 changes: 23 additions & 7 deletions libs/types/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
{
"name": "@openshift-assisted/types",
"versio": "1.0.0",
"version": "1.0.0",
"packageManager": "[email protected]",
"type": "module",
"exports": {
"./assisted-installer-service": {
"types": "./assisted-installer-service.d.ts"
},
"./accounts-management-service": {
"types": "./accounts-management-service.d.ts"
"./assisted-installer-service": "./assisted-installer-service.d.ts",
"./accounts-management-service": "./accounts-management-service.d.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"./assisted-installer-service": [
"./assisted-installer-service.d.ts"
],
"./accounts-management-service": [
"./accounts-management-service.d.ts"
]
}
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/openshift-assisted/assisted-installer-ui.git",
"directory": "libs/types"
},
"files": [
"accounts-management-service.d.ts",
"assisted-installer-service.d.ts",
"tsconfig.json"
],
"scripts": {
"update-types:assisted-installer-service": "node scripts/update-assisted-installer-service-types.js"
"update-types:assisted-installer-service": "node scripts/update-assisted-installer-service-types.js",
"watch": "yarn run -T toolbox watch --dir=. 'yalc push --changed'"
},
"devDependencies": {
"@types/js-yaml": "^4.0.1",
Expand Down
1 change: 0 additions & 1 deletion libs/types/tsconfig.eslint.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"extends": "./tsconfig.json",
"include": ["*.d.ts"],
"exclude": []
}
6 changes: 5 additions & 1 deletion libs/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "@tsconfig/recommended"
"compilerOptions": {
"resolveJsonModule": true,
"noEmit": true
},
"include": ["*.d.ts"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useFormikHelpers } from '../../../common/hooks/useFormikHelpers';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { HostDetail } from '../../../common/components/hosts/HostRowDetail';
import { ExpandComponentProps } from '../../../common/components/hosts/AITable';
import { Host } from '../../../common/api/types';
import { Host } from '@openshift-assisted/types/assisted-installer-service';
import {
HostsTableDetailContextProvider,
useHostsTableDetailContext,
Expand Down
2 changes: 1 addition & 1 deletion libs/ui-lib/lib/cim/components/Agent/tableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { sortable, expandable, breakWord } from '@patternfly/react-table';
import { Link } from 'react-router-dom';

import {
Host,
HostsTableActions,
getInventory,
getHostname,
Expand All @@ -27,6 +26,7 @@ import noop from 'lodash-es/noop.js';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { TFunction } from 'i18next';
import { AgentMachineK8sResource } from '../Hypershift/types';
import { Host } from '@openshift-assisted/types/assisted-installer-service';

export const agentHostnameColumn = (
t: TFunction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { Checkbox, FormGroup, Tooltip } from '@patternfly/react-core';
import { useField, useFormikContext } from 'formik';
import {
ClusterCreateParams,
CpuArchitecture,
getFieldId,
HelperText,
Expand All @@ -14,6 +13,7 @@ import {
useFeatureSupportLevel,
} from '../../../common/components/featureSupportLevels';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { ClusterCreateParams } from '@openshift-assisted/types/assisted-installer-service';

const Label = ({ version }: { version: string }) => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { ClusterCredentials, Credentials } from '../../../common';
import { ClusterCredentials } from '../../../common';
import { AgentK8sResource } from '../../types/k8s/agent';
import { AgentClusterInstallK8sResource } from '../../types/k8s/agent-cluster-install';
import { ClusterDeploymentK8sResource } from '../../types/k8s/cluster-deployment';
import { getAICluster } from '../helpers/toAssisted';
import { FetchSecret } from './types';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { Credentials } from '@openshift-assisted/types/assisted-installer-service';

type ClusterDeploymentCredentialsProps = {
clusterDeployment: ClusterDeploymentK8sResource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import noop from 'lodash-es/noop.js';
import { Stack, StackItem } from '@patternfly/react-core';
import { Host } from '../../../common/api/types';
import { Host } from '@openshift-assisted/types/assisted-installer-service';
import {
discoveryTypeColumn,
agentStatusColumn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { ConnectedIcon } from '@patternfly/react-icons';
import { EmptyState, Host } from '../../../common';
import { EmptyState } from '../../../common';
import { AgentTableActions } from './types';
import {
AgentClusterInstallK8sResource,
Expand All @@ -19,6 +19,7 @@ import {
} from '../../../common/components/hosts/tableUtils';
import { usePagination } from '../../../common/components/hosts/usePagination';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { Host } from '@openshift-assisted/types/assisted-installer-service';

type ExpandComponentContextType = {
onSetInstallationDiskId?: ClusterDeploymentHostsNetworkTableProps['onSetInstallationDiskId'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
StackItem,
} from '@patternfly/react-core';
import {
ClusterDefaultConfig,
CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4,
getHostSubnets,
SecurityFields,
Expand All @@ -36,6 +35,7 @@ import { useFormikContext } from 'formik';
import { getGridSpans } from './helpers';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { Trans } from 'react-i18next';
import { ClusterDefaultConfig } from '@openshift-assisted/types/assisted-installer-service';

// TODO(mlibra): So far a constant. Should be queried from somewhere.
export const defaultNetworkSettings: ClusterDefaultConfig = CLUSTER_DEFAULT_NETWORK_SETTINGS_IPV4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
ListItem,
} from '@patternfly/react-core';
import { TFunction } from 'i18next';
import { Cluster } from '../../../common/api/types';
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
import {
ValidationsInfo,
ValidationGroup as ClusterValidationGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import ClusterDeploymentWizardContext from './ClusterDeploymentWizardContext';
import { ClusterWizardStepHostStatusDeterminationObject } from '../../../common/types/hosts';
import { ValidationsInfo } from '../../../common/types/clusters';
import { Cluster } from '../../../common/api/types';
import { Cluster } from '@openshift-assisted/types/assisted-installer-service';
import { ClusterWizardStepsType, wizardStepsValidationsMap } from './wizardTransition';
import { AgentClusterInstallK8sResource } from '../../types/k8s/agent-cluster-install';
import { AgentK8sResource } from '../../types/k8s/agent';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '../../../common/components/clusterWizard/networkingSteps';
import {
canSelectNetworkTypeSDN,
ClusterDefaultConfig,
getDefaultNetworkType,
isAdvNetworkConf,
isSNO,
Expand All @@ -23,6 +22,7 @@ import {
} from '../../../common';
import { useTranslation } from '../../../common/hooks/use-translation-wrapper';
import { NetworkTypeControlGroup } from '../../../common/components/clusterWizard/networkingSteps/NetworkTypeControlGroup';
import { ClusterDefaultConfig } from '@openshift-assisted/types/assisted-installer-service';

export type NetworkConfigurationProps = VirtualIPControlGroupProps & {
defaultNetworkSettings: ClusterDefaultConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import mapKeys from 'lodash-es/mapKeys.js';
import camelCase from 'lodash-es/camelCase.js';
import uniq from 'lodash-es/uniq.js';
import { EventList } from '../../../common/api/types';
import { EventList } from '@openshift-assisted/types/assisted-installer-service';
import {
AgentClusterInstallK8sResource,
InfraEnvK8sResource,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import * as Yup from 'yup';
import { Cluster, ClusterDefaultConfig } from '../../../common/api';
import {
Cluster,
ClusterDefaultConfig,
} from '@openshift-assisted/types/assisted-installer-service';
import { HostSubnets, NetworkConfigurationValues } from '../../../common/types/clusters';
import {
hostPrefixValidationSchema,
Expand Down
Loading

0 comments on commit 7f4b62a

Please sign in to comment.