Skip to content

Commit

Permalink
migrate router and example from gcr to ghcr
Browse files Browse the repository at this point in the history
Signed-off-by: Rodolfo Sanchez <srodolfo@vmware.com>
  • Loading branch information
Rodolfo Sanchez committed Sep 17, 2023
1 parent 90bc719 commit 4cc2d66
Show file tree
Hide file tree
Showing 92 changed files with 329 additions and 1,643 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ jobs:
fetch-depth: 0
ref: "master"

- name: Set up Go
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: vmware-event-router/go.sum

- name: Setup ko
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Create CHANGELOG for Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -45,7 +48,7 @@ jobs:
docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} -o vmware-event-router/RELEASE_CHANGELOG.md $(basename "${{ github.ref }}" )
- name: GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8
uses: goreleaser/goreleaser-action@5fdedb94abba051217030cc86d4523cf3f02243d
with:
args: release --clean --release-notes RELEASE_CHANGELOG.md
workdir: vmware-event-router
Expand Down Expand Up @@ -100,11 +103,8 @@ jobs:
images:
needs: release
name: Create GCR image and release.yaml
name: Create Github Package image and release.yaml
timeout-minutes: 30
env:
KO_DOCKER_REPO: us.gcr.io/daisy-284300/veba # .../router@sha256:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
strategy:
matrix:
go-version: ["1.19"]
Expand All @@ -114,27 +114,16 @@ jobs:
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: vmware-event-router/go.sum
id: go

- id: login_to_gcp
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b

- name: Configure Docker
run: gcloud auth configure-docker --quiet

- name: Setup ko
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Get short COMMIT and TAG
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
Expand All @@ -161,4 +150,4 @@ jobs:
upload_url: ${{ steps.get_release_url.outputs.upload_url }}
asset_path: ./vmware-event-router/release.yaml
asset_name: release.yaml
asset_content_type: text/plain
asset_content_type: text/plain
8 changes: 3 additions & 5 deletions .github/workflows/router-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
id: go

- name: GoReleaser Snapshot
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8
uses: goreleaser/goreleaser-action@5fdedb94abba051217030cc86d4523cf3f02243d
with:
version: latest
args: release --clean --snapshot
Expand All @@ -66,15 +66,13 @@ jobs:

runs-on: ${{ matrix.platform }}
timeout-minutes: 20
env:
KO_DOCKER_REPO: us.gcr.io/daisy-284300/veba # .../router@sha256:

steps:
- name: Check out code
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
Expand All @@ -99,4 +97,4 @@ jobs:
name: release
path: |
./vmware-event-router/release.yaml
retention-days: 1
retention-days: 1
4 changes: 2 additions & 2 deletions .github/workflows/router-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache-dependency-path: vmware-event-router/go.sum

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Get short COMMIT and TAG (used by ko)
run: |
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
cache-dependency-path: vmware-event-router/go.sum

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Get short COMMIT and TAG (used by ko)
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,27 @@ jobs:

runs-on: ${{ matrix.platform }}
timeout-minutes: 20
env:
KO_DOCKER_REPO: us.gcr.io/daisy-284300/veba # .../router@sha256:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}

steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: vmware-event-router/go.sum
id: go

- id: login_to_gcp
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Setup ko
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Get short COMMIT and TAG
run: |
echo "KO_COMMIT=$(echo -n $GITHUB_SHA | cut -c -8)" >> $GITHUB_ENV
echo "KO_TAG=$(basename "${{ github.ref }}")" >> $GITHUB_ENV
- name: Build and push multi-arch image
id: build
run: |
# build and push with development tag
ko resolve --platform=linux/arm64,linux/amd64 --tags ${KO_COMMIT},development -BRf deploy/event-router-k8s.yaml
ko resolve --platform=linux/arm64,linux/amd64 --tags ${KO_COMMIT},development -BRf deploy/event-router-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,18 @@ jobs:

runs-on: ${{ matrix.platform }}
timeout-minutes: 20
env:
KO_DOCKER_REPO: us.gcr.io/daisy-284300/veba # .../router@sha256:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}

steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac

- name: Setup ko
uses: imjasonh/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa # v0.6

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: vmware-event-router/go.sum
id: go

- id: login_to_gcp
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'

- name: Set up gcloud
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b

- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Setup ko
uses: ko-build/setup-ko@ace48d793556083a76f1e3e6068850c1f4a369aa

- name: Get short COMMIT and TAG
run: |
Expand All @@ -55,4 +40,4 @@ jobs:
- name: Build and push multi-arch image
run: |
# build and push with pre-release tag
ko resolve --platform=linux/arm64,linux/amd64 --tags ${KO_COMMIT},${KO_TAG} -BRf deploy/event-router-k8s.yaml
ko resolve --platform=linux/arm64,linux/amd64 --tags ${KO_COMMIT},${KO_TAG} -BRf deploy/event-router-k8s.yaml
30 changes: 0 additions & 30 deletions .github/workflows/verify-gcr-login.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions docs/kb/function-tutorial-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
autoscaling.knative.dev/minScale: "1"
spec:
containers:
- image: us.gcr.io/daisy-284300/veba/kn-ps-slack:1.4
- image: ghcr.io/vmware-samples/vcenter-event-broker-appliance/kn-ps-slack:1.4
envFrom:
- secretRef:
name: slack-secret
Expand All @@ -59,7 +59,7 @@ spec:
<snip>
```

You can see that the default container referenced is: `us.gcr.io/daisy-284300/veba/kn-ps-slack:1.4`. We will replace this with our own container registry address.
You can see that the default container referenced is: `ghcr.io/vmware-samples/vcenter-event-broker-appliance/kn-ps-slack:1.4`. We will replace this with our own container registry address.

First, open a command prompt/terminal and push the Docker image (replace docker-username with your Docker username):

Expand Down
6 changes: 3 additions & 3 deletions docs/kb/function-tutorial-modtest.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This part of the tutorial will go over:
The PowerShell code is contained in the `handler.ps1` file. The default function sends an alert to a Slack webhook when a Virtual Machine is powered off. This handler file is included in the Docker image and so if it changes, it will require a rebuild of the Docker image. You can see how the `handler.ps1` file is reference in the `Dockerfile` used to build the Docker image - note the `COPY handler.ps1 handler.ps1` command within the file:

```
FROM us.gcr.io/daisy-284300/veba/ce-ps-base:1.4
FROM ghcr.io/vmware-samples/vcenter-event-broker-appliance/ce-ps-base:1.4
COPY handler.ps1 handler.ps1
Expand Down Expand Up @@ -107,10 +107,10 @@ docker build -t atauber/kn-ps-slack:1.1 .
=> => transferring dockerfile: 36B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for us.gcr.io/daisy-284300/veba/ce-ps-base:1.4 0.3s
=> [internal] load metadata for ghcr.io/vmware-samples/vcenter-event-broker-appliance/ce-ps-base:1.4 0.3s
=> [internal] load build context 0.0s
=> => transferring context: 33B 0.0s
=> [1/2] FROM us.gcr.io/daisy-284300/veba/ce-ps-base:1.4@sha256:bb2c42f7355ad50e957e689dfb8f3fca0390f17290fdd2e1065d7d34a055f29b 0.0s
=> [1/2] FROM ghcr.io/vmware-samples/vcenter-event-broker-appliance/ce-ps-base:1.4@sha256:bb2c42f7355ad50e957e689dfb8f3fca0390f17290fdd2e1065d7d34a055f29b 0.0s
=> CACHED [2/2] COPY handler.ps1 handler.ps1 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
Expand Down
2 changes: 1 addition & 1 deletion docs/kb/use-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Although the previous examples using the `kn-ps-echo` function did not require c
You can verify whether a function requires a secret by looking at the function's `function.yaml`. Below is part of the `function.yaml` for `kn-ps-email`. Note the `secretRef:` section specifying the name of the secret the function expects.
```yaml
containers:
- image: us.gcr.io/daisy-284300/veba/kn-ps-email:1.4
- image: ghcr.io/vmware-samples/vcenter-event-broker-appliance/kn-ps-email:1.4
envFrom:
- secretRef:
name: email-secret
Expand Down
Loading

0 comments on commit 4cc2d66

Please sign in to comment.