Skip to content

Commit

Permalink
generalize urls and image names
Browse files Browse the repository at this point in the history
Signed-off-by: Rodolfo Sanchez <[email protected]>
  • Loading branch information
Rodolfo Sanchez committed Sep 15, 2023
1 parent 3e5dff3 commit 954dc5c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions examples/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ For `ko`, you need to set the base url for the repository these images are going
export KO_DOCKER_REPO=ghcr.io/<github-account>/vcenter-event-broker-appliance
```

You also need to set two environment variables for `ko`: `KO_TAG` and `KO_COMMIT`
You also need to set two environment variables for `ko`: `KO_TAG`, `KO_DOCKER_REPO`, and `KO_COMMIT`

```bash
export KO_COMMIT=$(git rev-parse --short=8 HEAD)
export KO_TAG=<new-version>
export KO_DOCKER_REPO=ghcr.io/<docker-username>/<repo-name>
```

Now you can build and push your new version of the example using `ko build`

```bash
ko build . --image-label org.opencontainers.image.source="https://github.com/<github-account>/vcenter-event-broker-appliance/" --tags <new-version> --tags latest -B
ko build . --image-label org.opencontainers.image.source="<github-domain>/<github-username>/<repo-name>" --tags <new-version> --tags latest -B
```

### Notes
- On GitHub, in order to attach an image to a repository we need to set the label `org.opencontainers.image.source` of the repository the package will be associated with.
- we use the flag `-B` in order to use the base path without MD5 hash after `KO_DOCKER_REPO`
- > Currently, there is a behavior I am trying to debug where the tag of the image source does not work and it does not attach the package to the repository. If you find yourself in the situation you can attach the repository on the GitHub Package webpage

## Powercli Powershell

Expand All @@ -67,14 +67,14 @@ For the Powercli examples we need to build the template that is on [knative/temp
These templates use Dockerfiles and can build them using `docker build`. After you built the images we need to tag the images

```bash
docker image tag <template-image> ghcr.io/<github-account>/vcenter-event-broker-appliance/<template-image>:latest
docker image tag <template-image> ghcr.io/<github-account>/vcenter-event-broker-appliance/<template-image>:<new-version>
docker image tag <template-image-name> ghcr.io/<github-username>/<repo-name>/<template-image>:latest
docker image tag <template-image-name> ghcr.io/<github-username>/<repo-name>/<template-image>:<new-version>
```

To push these images we need to run

```bash
docker image push --all-tags ghcr.io/<github-account>/vcenter-event-broker-appliance/<template-image>
docker image push --all-tags <template-image-name>
```

> Notes: the PowerCLI template depends on the PowerPS image. You need to build the base before the CLI version
Expand All @@ -86,19 +86,19 @@ After you build the templates, you can now build any example on `knative/powersh
[Buildpacks](https://buildpacks.io) are used to create the container image. We can build any example by using:

```bash
IMAGE=<docker-username>/<example-name>:<version>
IMAGE=ghcr.io/<docker-username>/<repo-name>/<image-name>:<version>
pack build -B gcr.io/buildpacks/builder:v1 ${IMAGE}
```
If you are using [email protected] or newer version you can label images like

```bash
pack buildpack package $IMAGE -l org.opencontainers.image.source="https://github.com/<github-account>/vcenter-event-broker-appliance"
pack buildpack package $IMAGE -l org.opencontainers.image.source="<github-domain>/<github-username>/<repo-name>"
```

If you are using pack with an older version, we need to use `gcr.io/paketo-buildpacks/image-labels:4.5.2` buildpack

```bash
pack build -B gcr.io/buildpacks/builder:v1 -b gcr.io/paketo-buildpacks/image-labels:4.5.2 $IMAGE -e BP_IMAGE_LABELS=org.opencontainers.image.source="https://github.com/<github-account>/vcenter-event-broker-appliance"
pack build -B gcr.io/buildpacks/builder:v1 -b gcr.io/paketo-buildpacks/image-labels:4.5.2 $IMAGE -e BP_IMAGE_LABELS=org.opencontainers.image.source="<github-domain>/<github-username>/<repo-name>"
```

and then we can push the image
Expand Down

0 comments on commit 954dc5c

Please sign in to comment.