diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5f7c080..341fbfb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -5,18 +5,22 @@ on: - 'v*' jobs: image: - name: Push images to quay.io + name: Push container images runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - uses: actions/setup-go@v4 with: go-version-file: go.mod - - name: Log in quay.io - run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USER }} --password-stdin quay.io + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - run: make setup - run: make image - - run: make tag push IMAGE_PREFIX=quay.io/cybozu/ IMAGE_TAG=${GITHUB_REF#refs/tags/v} + - run: make tag push IMAGE_PREFIX=ghcr.io/cybozu-go/ IMAGE_TAG=${GITHUB_REF#refs/tags/v} release: name: Release on GitHub needs: image diff --git a/Dockerfile b/Dockerfile index a9b9e02..850aae6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM quay.io/cybozu/golang:1.20-jammy as builder +FROM ghcr.io/cybozu/golang:1.20-jammy as builder WORKDIR /workspace COPY . . RUN make build -FROM quay.io/cybozu/ubuntu:22.04 as controller +FROM ghcr.io/cybozu/ubuntu:22.04 as controller +LABEL org.opencontainers.image.source="https://github.com/cybozu-go/meows" COPY --from=builder /workspace/tmp/bin/controller /usr/local/bin COPY --from=builder /workspace/tmp/bin/slack-agent /usr/local/bin @@ -13,7 +14,8 @@ COPY --from=builder /workspace/tmp/bin/meows /usr/local/bin USER 10000:10000 ENTRYPOINT ["controller"] -FROM quay.io/cybozu/ubuntu:22.04 as runner +FROM ghcr.io/cybozu/ubuntu:22.04 as runner +LABEL org.opencontainers.image.source="https://github.com/cybozu-go/meows" # Even if the version of the runner is out of date, it will self-update at job execution time. So there is no problem to update it when you notice. # TODO: Until https://github.com/cybozu-go/meows/issues/137 is fixed, update it manually. diff --git a/README.md b/README.md index 347f22c..ac59013 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ You can run jobs in your GitHub Actions workflows on your Kubernetes cluster wit ## Docker images -Docker images are available on [Quay.io](https://quay.io/repository/cybozu) -- [Controller](https://quay.io/repository/cybozu/meows-controller) -- [Runner](https://quay.io/repository/cybozu/meows-runner) +Docker images are available on [ghcr.io](https://github.com/orgs/cybozu-go/packages?repo_name=meows) +- [Controller](https://github.com/cybozu-go/meows/pkgs/container/meows-controller) +- [Runner](https://github.com/cybozu-go/meows/pkgs/container/meows-runner) [releases]: https://github.com/cybozu-go/meows/releases diff --git a/cmd/controller/cmd/root.go b/cmd/controller/cmd/root.go index 604dd23..0492fc1 100644 --- a/cmd/controller/cmd/root.go +++ b/cmd/controller/cmd/root.go @@ -12,7 +12,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log/zap" ) -const defaultRunnerImage = "quay.io/cybozu/meows-runner:" + constants.Version +const defaultRunnerImage = "ghcr.io/cybozu-go/meows-runner:" + constants.Version var config struct { zapOpts zap.Options diff --git a/config/agent/kustomization.yaml b/config/agent/kustomization.yaml index 2987fba..6b053d9 100644 --- a/config/agent/kustomization.yaml +++ b/config/agent/kustomization.yaml @@ -1,7 +1,7 @@ namespace: meows images: -- name: quay.io/cybozu/meows-controller +- name: ghcr.io/cybozu-go/meows-controller newTag: 0.13.0 commonLabels: diff --git a/config/agent/manifests.yaml b/config/agent/manifests.yaml index 54846a4..168584f 100644 --- a/config/agent/manifests.yaml +++ b/config/agent/manifests.yaml @@ -47,7 +47,7 @@ spec: spec: containers: - name: agent - image: quay.io/cybozu/meows-controller:latest + image: ghcr.io/cybozu-go/meows-controller:latest command: - "slack-agent" envFrom: diff --git a/config/controller/deployment.yaml b/config/controller/deployment.yaml index eeab14f..b14b4a7 100644 --- a/config/controller/deployment.yaml +++ b/config/controller/deployment.yaml @@ -19,7 +19,7 @@ spec: runAsNonRoot: true containers: - name: controller - image: quay.io/cybozu/meows-controller:latest + image: ghcr.io/cybozu-go/meows-controller:latest env: - name: POD_NAMESPACE valueFrom: diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index 16a5674..6f6e4e1 100644 --- a/config/controller/kustomization.yaml +++ b/config/controller/kustomization.yaml @@ -1,7 +1,7 @@ namespace: meows images: -- name: quay.io/cybozu/meows-controller +- name: ghcr.io/cybozu-go/meows-controller newTag: 0.13.0 namePrefix: meows- diff --git a/kindtest/helper_test.go b/kindtest/helper_test.go index 6431d60..43e33a4 100644 --- a/kindtest/helper_test.go +++ b/kindtest/helper_test.go @@ -5,7 +5,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "os" "os/exec" @@ -190,16 +189,12 @@ func findDebuggingPod(pods *corev1.PodList) (*corev1.Pod, *runner.Status) { func waitJobCompletion(namespace, runnerpool string) (*corev1.Pod, *runner.Status) { var po *corev1.Pod var status *runner.Status - EventuallyWithOffset(1, func() error { + EventuallyWithOffset(1, func(g Gomega) { pods, err := fetchRunnerPods(namespace, runnerpool) - if err != nil { - return err - } + g.Expect(err).NotTo(HaveOccurred()) + po, status = findDebuggingPod(pods) - if po == nil { - return errors.New("one pod should become debugging state") - } - return nil + g.Expect(po).NotTo(BeNil(), "one pod should become debugging state") }, 3*time.Minute, 500*time.Millisecond).ShouldNot(HaveOccurred()) return po, status } diff --git a/kindtest/runner_test.go b/kindtest/runner_test.go index 3051bea..866f6d7 100644 --- a/kindtest/runner_test.go +++ b/kindtest/runner_test.go @@ -124,6 +124,12 @@ func testRunner() { }))) By("checking pdb") + Eventually(func(g Gomega) { + _, stderr, err := kubectl("get", "pdb", "-n", repoRunner1NS, assignedPod.Name) + g.Expect(err).NotTo(HaveOccurred(), fmt.Errorf("stderr: %s", stderr)) + }).Should(Succeed()) + + By("trying to evict the pod") _, stderr, err := kubectl("evict", "-n", repoRunner1NS, assignedPod.Name) Expect(err).Should(HaveOccurred()) // The error message should be: "Error: Cannot evict pod as it would violate the pod's disruption budget."