Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cockpit/cockpit-image-builder.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ BuildRequires: nodejs
Requires: cockpit
Requires: cockpit-files
Requires: osbuild-composer >= 131
Requires: image-builder >= 33

%description
The image-builder-frontend generates custom images suitable for
Expand Down
1 change: 1 addition & 0 deletions fec.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ module.exports = {
// to false
cockpit: false,
'cockpit/fsinfo': false,
'long-running-process': false,
'os-release': false,
},
},
Expand Down
17 changes: 16 additions & 1 deletion playwright/test.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { readFileSync } from 'node:fs';
import { readFileSync, writeFileSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';

import TOML from '@ltd/j-toml';
import { expect, test } from '@playwright/test';
Expand All @@ -8,6 +10,12 @@ import { closePopupsIfExist, isHosted } from './helpers/helpers';
import { ensureAuthenticated } from './helpers/login';
import { ibFrame, navigateToLandingPage } from './helpers/navHelpers';

const awsCredentials = `
[default]
aws_access_key_id = supersecret
aws_secret_access_key = secretsquirrel
`;

test.describe.serial('test', () => {
const blueprintName = uuidv4();
test('create blueprint', async ({ page }) => {
Expand Down Expand Up @@ -266,6 +274,13 @@ test.describe.serial('test', () => {
return;
}

// this needs to be set so ibcli will list aws targets
// as an available image type
writeFileSync(
path.join(os.homedir(), '.aws', 'credentials'),
awsCredentials,
);

await ensureAuthenticated(page);
await closePopupsIfExist(page);
// Navigate to IB landing page and get the frame
Expand Down
14 changes: 14 additions & 0 deletions schutzbot/Containerfile-Playwright
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubuntu:latest AS builder
RUN apt update
RUN apt install -y git golang libgpgme-dev libbtrfs-dev libdevmapper-dev podman
RUN git clone https://github.com/osbuild/image-builder-cli.git ibcli
WORKDIR ibcli
RUN ls -al
RUN go mod tidy && go mod vendor
RUN go build -o /opt ./cmd/image-builder/

FROM mcr.microsoft.com/playwright:v1.51.1-noble
RUN apt update
# Needed for running image-builder
RUN apt install -y libgpgme-dev libbtrfs-dev libdevmapper-dev
COPY --from=builder /opt /usr/bin
4 changes: 3 additions & 1 deletion schutzbot/playwright_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ sudo useradd admin -p "$(openssl passwd foobar)"
sudo usermod -aG wheel admin
echo "admin ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee "/etc/sudoers.d/admin-nopasswd"

sudo podman build --tag playwright -f $(pwd)/schutzbot/Containerfile-Playwright .

function upload_artifacts {
if [ -n "${TMT_TEST_DATA:-}" ]; then
mv playwright-report "$TMT_TEST_DATA"/playwright-report
Expand Down Expand Up @@ -88,5 +90,5 @@ sudo podman run \
--privileged \
--rm \
--init \
mcr.microsoft.com/playwright:v1.51.1-noble \
localhost/playwright \
/bin/sh -c "cd tests && npx -y [email protected] test --workers=${PW_WORKERS}"
19 changes: 13 additions & 6 deletions src/AppCockpit.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
import '@patternfly/react-core/dist/styles/base.css';
import '@patternfly/patternfly/patternfly-addons.css';

import React from 'react';
import React, { useEffect, useState } from 'react';

import 'cockpit-dark-theme';
import { Page, PageSection } from '@patternfly/react-core';
import { Spinner } from '@redhat-cloud-services/frontend-components';
import NotificationsProvider from '@redhat-cloud-services/frontend-components-notifications/NotificationsProvider';
import cockpit from 'cockpit';
import { createRoot } from 'react-dom/client';
import { Provider } from 'react-redux';
import { HashRouter } from 'react-router-dom';

import './AppCockpit.scss';
import { NotReady, RequireAdmin } from './Components/Cockpit';
import { RequireAdmin } from './Components/Cockpit';
import { Router } from './Router';
import { onPremStore as store } from './store';
import { useGetComposerSocketStatus } from './Utilities/useComposerStatus';
import { useIsCockpitAdmin } from './Utilities/useIsCockpitAdmin';

const Application = () => {
const { enabled, started } = useGetComposerSocketStatus();
const isAdmin = useIsCockpitAdmin();
const [ready, setReady] = useState(false);

if (!started || !enabled) {
return <NotReady enabled={enabled} />;
useEffect(() => {
if (cockpit) {
setReady(true);
}
}, [cockpit, ready, setReady]);

if (!ready) {
return <Spinner centered />;
}

if (!isAdmin) {
Expand Down
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export const CENTOS_9 = 'centos-9';
export const CENTOS_10 = 'centos-10';
export const FEDORA_41 = 'fedora-41';
export const FEDORA_42 = 'fedora-42';
export const FEDORA_43 = 'fedora-43';
export const X86_64 = 'x86_64';
export const AARCH64 = 'aarch64';

Expand Down Expand Up @@ -97,6 +98,7 @@ export const ON_PREM_RELEASES = new Map([
[CENTOS_10, 'CentOS Stream 10'],
[FEDORA_41, 'Fedora Linux 41'],
[FEDORA_42, 'Fedora Linux 42'],
[FEDORA_43, 'Fedora Linux 43'],
[RHEL_10, 'Red Hat Enterprise Linux (RHEL) 10'],
]);

Expand Down Expand Up @@ -310,3 +312,4 @@ export const PAGINATION_COUNT = 0;
export const SEARCH_INPUT = '';

export const BLUEPRINTS_DIR = '.cache/cockpit-image-builder/';
export const ARTIFACTS_DIR = '/var/lib/osbuild-composer/artifacts';
Loading