Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 4, 2025

Project exports were dropping the repository reference from file-type inventories, forcing manual reconfiguration after import.

Changes

services/project/types.go

  • Added Repository field to BackupInventory struct

services/project/backup.go

  • Extract repository name when building inventory backups (similar to existing SSHKey/BecomeKey handling)

services/project/restore.go

  • Resolve repository name back to ID during restore
  • Verify repository exists during validation

services/project/backup_test.go

  • Added TestBackup_InventoryWithRepository covering export/import cycle

Result

Exported inventories now preserve repository associations:

"inventories": [
  {
    "inventory": "inventory/bast-inventory.aws_ec2.yaml",
    "name": "bastion-hat-global",
    "repository": "bastion-build",
    "ssh_key": "ansible",
    "type": "file"
  }
]
Original prompt

This section details on the original issue you should resolve

<issue_title>Problem: Project export does not contain repository for an inventory</issue_title>
<issue_description>### Issue

When exporting a project that contains an ansible inventory that refers to a file held in a repository the exported project does not contain reference to the repository - E.g:

"inventories": [
    {
      "inventory": "inventory/bast-inventory.aws_ec2.yaml",
      "name": "bastion-hat-global",
      "ssh_key": "ansible",
      "type": "file"
    }
  ],

Have tried adding the repository into the project template as follows:

"inventories": [
        {
            "inventory": "inventory/bast-inventory.aws_ec2.yaml",
            "name": "bastion-hat-global",
            "ssh_key": "ansible",
            "type": "file",
            "repository": "bastion-build"
        }
    ],

However, this does not work.

I have attached a screenshot of the inventory config in the UI. This means currently we have to change this setting manually in the UI or then make an additional API call to update the inventory.

Image

Impact

Semaphore Project

Installation method

Package

Database

Postgres

Browser

No response

Semaphore Version

2.16.16-4066a1e-1755360390

Ansible Version

Logs & errors

No response

Manual installation - system information

No response

Configuration

No response

Additional information

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 4, 2025 21:05
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Co-authored-by: fiftin <914224+fiftin@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix project export missing repository in inventory Fix project export to include inventory repository references Nov 4, 2025
Copilot finished work on behalf of fiftin November 4, 2025 21:13
Copilot AI requested a review from fiftin November 4, 2025 21:13
@fiftin fiftin marked this pull request as ready for review November 4, 2025 21:39
@fiftin
Copy link
Collaborator

fiftin commented Nov 4, 2025

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem: Project export does not contain repository for an inventory

2 participants