|
| 1 | +--- |
| 2 | +date: "2023-01-20T00:00:00+00:00" |
| 3 | +title: "Chef Packages Repository" |
| 4 | +slug: "packages/chef" |
| 5 | +draft: false |
| 6 | +toc: false |
| 7 | +menu: |
| 8 | + sidebar: |
| 9 | + parent: "packages" |
| 10 | + name: "Chef" |
| 11 | + weight: 5 |
| 12 | + identifier: "chef" |
| 13 | +--- |
| 14 | + |
| 15 | +# Chef Packages Repository |
| 16 | + |
| 17 | +Publish [Chef](https://chef.io/) cookbooks for your user or organization. |
| 18 | + |
| 19 | +**Table of Contents** |
| 20 | + |
| 21 | +{{< toc >}} |
| 22 | + |
| 23 | +## Requirements |
| 24 | + |
| 25 | +To work with the Chef package registry, you have to use [`knife`](https://docs.chef.io/workstation/knife/). |
| 26 | + |
| 27 | +## Authentication |
| 28 | + |
| 29 | +The Chef package registry does not use an username:password authentication but signed requests with a private:public key pair. |
| 30 | +Visit the package owner settings page to create the necessary key pair. |
| 31 | +Only the public key is stored inside Gitea. if you loose access to the private key you must re-generate the key pair. |
| 32 | +[Configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the downloaded private key with your Gitea username as `client_name`. |
| 33 | + |
| 34 | +## Configure the package registry |
| 35 | + |
| 36 | +To [configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the Gitea package registry add the url to the `~/.chef/config.rb` file. |
| 37 | + |
| 38 | +``` |
| 39 | +knife[:supermarket_site] = 'https://gitea.example.com/api/packages/{owner}/chef' |
| 40 | +``` |
| 41 | + |
| 42 | +| Parameter | Description | |
| 43 | +| --------- | ----------- | |
| 44 | +| `owner` | The owner of the package. | |
| 45 | + |
| 46 | +## Publish a package |
| 47 | + |
| 48 | +To publish a Chef package execute the following command: |
| 49 | + |
| 50 | +```shell |
| 51 | +knife supermarket share {package_name} |
| 52 | +``` |
| 53 | + |
| 54 | +| Parameter | Description | |
| 55 | +| -------------- | ----------- | |
| 56 | +| `package_name` | The package name. | |
| 57 | + |
| 58 | +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. |
| 59 | + |
| 60 | +## Install a package |
| 61 | + |
| 62 | +To install a package from the package registry, execute the following command: |
| 63 | + |
| 64 | +```shell |
| 65 | +knife supermarket install {package_name} |
| 66 | +``` |
| 67 | + |
| 68 | +Optional you can specify the package version: |
| 69 | + |
| 70 | +```shell |
| 71 | +knife supermarket install {package_name} {package_version} |
| 72 | +``` |
| 73 | + |
| 74 | +| Parameter | Description | |
| 75 | +| ----------------- | ----------- | |
| 76 | +| `package_name` | The package name. | |
| 77 | +| `package_version` | The package version. | |
| 78 | + |
| 79 | +## Delete a package |
| 80 | + |
| 81 | +If you want to remove a package from the registry, execute the following command: |
| 82 | + |
| 83 | +```shell |
| 84 | +knife supermarket unshare {package_name} |
| 85 | +``` |
| 86 | + |
| 87 | +Optional you can specify the package version: |
| 88 | + |
| 89 | +```shell |
| 90 | +knife supermarket unshare {package_name}/versions/{package_version} |
| 91 | +``` |
| 92 | + |
| 93 | +| Parameter | Description | |
| 94 | +| ----------------- | ----------- | |
| 95 | +| `package_name` | The package name. | |
| 96 | +| `package_version` | The package version. | |
0 commit comments