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

v2 can't pass context to tmt #136

Closed
henrywang opened this issue Mar 21, 2024 · 3 comments · Fixed by #137
Closed

v2 can't pass context to tmt #136

henrywang opened this issue Mar 21, 2024 · 3 comments · Fixed by #137
Assignees
Labels
type: bug Something isn't working

Comments

@henrywang
Copy link

Configured context in the github action, but it can't be passed to tmt.
Configuration in github action:

Run sclorg/testing-farm-as-github-action@v2
  with:
    compose: CentOS-Stream-9
    api_key: ***
    git_url: https://github.com/henrywang/bootc-workflow-test
    git_ref: osbuild_fix
    arch: x86_64
    tmt_context: arch=x86_64
    update_pull_request_status: true
    pull_request_status_name: bootc-cs9-x86_64-bib-qcow2
    tmt_plan_regex: qcow2
    tf_scope: private
    secrets: QUAY_USERNAME=***;QUAY_PASSWORD=***
    variables: TEST_OS=centos-stream-9;PLATFORM=libvirt;ARCH=x86_64;IMAGE_TYPE=qcow2;AWS_REGION=***;GOVC_INSECURE=1
    api_url: https://api.dev.testing-farm.io/v0.1
    github_token: ***
    create_issue_comment: false
    create_github_summary: true
    copr: epel-7-x86_64
    environment_settings: {}
    timeout: 480

Testing farm log:

[32m[09:38:08] [+] [testing-farm-request] Connected to Testing Farm Service 'https://internal.api.dev.testing-farm.io'�[0m
�[32m[09:38:09] [+] [testing-farm-request] Initialized with 184f6b60-bd1f-4940-9a81-51f6b54b69d1:
{
    "environments_requested": [
        {
            "arch": "x86_64",
            "artifacts": [],
            "compose": "CentOS-Stream-9",
            "secrets": "******",
            "settings": {
                "pipeline": null,
                "provisioning": null
            },
            "snapshots": false,
            "tmt": {
                "context": null,
                "environment": null
            },
            "variables": {
                "ARCH": "x86_64",
                "AWS_REGION": "***",
                "GOVC_INSECURE": "1",
                "IMAGE_TYPE": "qcow2",
                "PLATFORM": "libvirt",
                "TESTING_FARM_GIT_REF": "osbuild_fix",
                "TESTING_FARM_GIT_URL": "https://github.com/henrywang/bootc-workflow-test",
                "TESTING_FARM_REQUEST_ID": "184f6b60-bd1f-4940-9a81-51f6b54b69d1",
                "TESTING_FARM_TEST_TYPE": "fmf",
                "TEST_OS": "centos-stream-9"
            }
        }
    ],
    "plan": "qcow2",
    "plan_filter": "<not applicable>",
    "ref": "osbuild_fix",
    "test_filter": "<not applicable>",
    "test_name": "<not applicable>",
    "type": "fmf",
    "url": "https://github.com/henrywang/bootc-workflow-test",
    "webhook_url": "<no webhook specified>"
}�[0m
@jamacku
Copy link
Member

jamacku commented Mar 21, 2024

I don't see any issue based on the logs you have provided, That context seems to be passed correctly to TF.

tmt_context: arch=x86_64 ~ "variables": {"ARCH": "x86_64",...}

EDIT: Actually, you are right. There is a bug. We expect that all context variables are passed, which is probably a wrong assumption.

Corresponding code:

// Generate tmt context
const tmtContextParsed = tmtContextInputSchema.safeParse(
getInput('tmt_context')
);
const tmtContext = tmtContextParsed.success
? tmtContextSchema.parse(tmtContextParsed.data)
: undefined;

// https://testing-farm.gitlab.io/api/#operation/requestsPost
export const tmtContextSchema = z
.object({
distro: z.string().min(1),
arch: z.string().min(1),
trigger: z.string().min(1),
})
.optional()
.or(z.object({}).transform(() => undefined));

@henrywang
Copy link
Author

henrywang commented Mar 21, 2024

I don't see any issue based on the logs you have provided, That context seems to be passed correctly to TF.

tmt_context: arch=x86_64 ~ "variables": {"ARCH": "x86_64",...}

Corresponding code:

// Generate tmt context
const tmtContextParsed = tmtContextInputSchema.safeParse(
getInput('tmt_context')
);
const tmtContext = tmtContextParsed.success
? tmtContextSchema.parse(tmtContextParsed.data)
: undefined;

// https://testing-farm.gitlab.io/api/#operation/requestsPost
export const tmtContextSchema = z
.object({
distro: z.string().min(1),
arch: z.string().min(1),
trigger: z.string().min(1),
})
.optional()
.or(z.object({}).transform(() => undefined));

The ARCH is variable I defined as environment variable. But the arch is the context I defined and it's null now.

tmt": {
                "context": null,
                "environment": null
            },

The right one should look like:

"tmt": {
                "context": {
                    "arch": "x86_64"
                },
                "environment": null
            },

@jamacku
Copy link
Member

jamacku commented Mar 21, 2024

You are right I have just updated my comment above

@jamacku jamacku added the type: bug Something isn't working label Mar 21, 2024
@jamacku jamacku self-assigned this Mar 21, 2024
jamacku added a commit to jamacku/testing-farm that referenced this issue Mar 21, 2024
jamacku added a commit to redhat-plumbers-in-action/testing-farm that referenced this issue Mar 21, 2024
@jamacku jamacku linked a pull request Mar 21, 2024 that will close this issue
zmiklank pushed a commit that referenced this issue Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants