Skip to content

Issue with CodeBuild Runner for GitHub Actions – "YAML file does not exist"

0

Hello,

I have set up an AWS CodeBuild runner to act as a self-hosted GitHub Actions runner. I manually enabled the "Create Webhook" option in the AWS Console and enter the payload URL and secret in repo, and I can see that the webhook successfully receives ping and other requests.

I have configured the webhook to trigger on pull requests, and when I create a pull request, it correctly triggers GitHub Actions and the CodeBuild runner. However, the workflow fails with the error:

"YAML file does not exist"

I reviewed the documentation for CodeBuild runners, which states that when running as a self-hosted GitHub runner, the buildspec file should not be required. However, I am still facing this issue.

Additionally, I would like to confirm:

Do I need to explicitly register the CodeBuild runner with my GitHub repository? Since the runner runs in a container, how should I handle this registration? I would appreciate any guidance on resolving this issue. Please let me know if you need any additional details.

Thank you.

asked a year ago559 views
3 Answers
0

It seems there might be a misunderstanding in how you've set up your CodeBuild project for GitHub Actions integration. When using CodeBuild as a self-hosted GitHub Actions runner, you don't need to manually create a webhook or configure it to trigger on pull requests. Instead, the process should be as follows:

  1. Create a CodeBuild project specifically for hosting GitHub Actions runners.
  2. In the project settings, under "Primary source webhook events", select "Rebuild every time a code change is pushed to this repository".
  3. For the "Event type", choose "WORKFLOW_JOB_QUEUED". This is crucial as it ensures CodeBuild only processes GitHub Actions workflow jobs.

The "YAML file does not exist" error suggests that CodeBuild is trying to run a build directly, rather than acting as a GitHub Actions runner. This behavior indicates that the webhook might be incorrectly configured.

Regarding your questions:

  1. You don't need to explicitly register the CodeBuild runner with your GitHub repository. The integration between CodeBuild and GitHub Actions is handled automatically when you set up the project correctly.

  2. The runner registration is managed by CodeBuild when it's properly configured as a GitHub Actions runner. You don't need to handle this manually.

To resolve the issue:

  1. Review your CodeBuild project settings and ensure you've selected "WORKFLOW_JOB_QUEUED" as the event type.

  2. Make sure your GitHub Actions workflow YAML file includes the correct runner label. It should look something like this:

    runs-on:
      - codebuild-myProject-${{ github.run_id }}-${{ github.run_attempt }}

    Replace "myProject" with your actual CodeBuild project name.

  3. If you've manually set up webhooks in your GitHub repository settings, remove them and let CodeBuild handle the webhook creation.

  4. Ensure your GitHub Actions workflow file is properly formatted and located in the correct directory (.github/workflows) in your repository.

By following these steps, CodeBuild should correctly function as a self-hosted GitHub Actions runner without requiring a buildspec file or manual runner registration.

Sources
Self-hosted GitHub Actions runners in AWS CodeBuild - AWS CodeBuild
AWS CodeBuild Managed Self-Hosted GitHub Action Runners | AWS DevOps & Developer Productivity Blog
Label overrides supported with the CodeBuild-hosted GitHub Actions runner - AWS CodeBuild

answered a year ago
0

I can only see these options on my console

Enter image description here

answered a year ago
0

I was able to run the workflow by selecting the "workflow jobs" option. I checked "Pull requests," which triggered two builds. One build ran successfully with the workflow job, but the other one encountered an error stating, "YAML file does not exist."

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.