worker: remove osbuild-koji job

Koji API removed by the previous commit was the last user of osbuild-koji job.
Let's remove it since nothing uses it. This also removes all of the
compatibility code in Cloud API, see concerns below:

Compatibility concerns:
- the internal deployment was moved to a completely different composer
  instance, thus there are no old jobs
- Fedora deployment is still unused in prod, thus we don't care about keeping
  backward compatibility of the old jobs

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-07-12 11:57:10 +02:00 committed by Ondřej Budai
parent 74eb3860df
commit e779562f3c
9 changed files with 103 additions and 861 deletions

View file

@ -924,15 +924,6 @@ func (h *apiHandlers) getComposeLogsImpl(ctx echo.Context, id string) error {
}
switch buildJobType {
// TODO: remove eventually. Kept for backward compatibility
case worker.JobTypeOSBuildKoji:
var buildResult worker.OSBuildKojiJobResult
_, _, err = h.server.workers.OSBuildKojiJobStatus(deps[i], &buildResult)
if err != nil {
return HTTPErrorWithInternal(ErrorComposeNotFound, err)
}
buildResultBlobs = append(buildResultBlobs, buildResult)
case worker.JobTypeOSBuild:
var buildResult worker.OSBuildJobResult
_, _, err = h.server.workers.OSBuildJobStatus(deps[i], &buildResult)
@ -1026,28 +1017,6 @@ func (h *apiHandlers) getComposeManifestsImpl(ctx echo.Context, id string) error
var manifest distro.Manifest
switch buildJobType {
// TODO: remove eventually. Kept for backward compatibility
case worker.JobTypeOSBuildKoji:
var buildJob worker.OSBuildKojiJob
err = h.server.workers.OSBuildKojiJob(deps[i], &buildJob)
if err != nil {
return HTTPErrorWithInternal(ErrorComposeNotFound, err)
}
if len(buildJob.Manifest) != 0 {
manifest = buildJob.Manifest
} else {
_, buildDeps, err := h.server.workers.OSBuildKojiJobStatus(deps[i], &worker.OSBuildKojiJobResult{})
if err != nil {
return HTTPErrorWithInternal(ErrorComposeNotFound, err)
}
manifestResult, err := manifestJobResultsFromJobDeps(h.server.workers, buildDeps)
if err != nil {
return HTTPErrorWithInternal(ErrorComposeNotFound, fmt.Errorf("job %q: %v", jobId, err))
}
manifest = manifestResult.Manifest
}
case worker.JobTypeOSBuild:
var buildJob worker.OSBuildJob
err = h.server.workers.OSBuildJob(deps[i], &buildJob)

View file

@ -604,7 +604,7 @@ func TestKojiJobTypeValidation(t *testing.T) {
t.Logf("%q job ID: %s", worker.JobTypeKojiInit, initID)
t.Logf("%q job ID: %s", worker.JobTypeKojiFinalize, finalizeID)
t.Logf("%q job IDs: %v", worker.JobTypeOSBuildKoji, buildJobIDs)
t.Logf("%q job IDs: %v", worker.JobTypeOSBuild, buildJobIDs)
for _, path := range []string{"", "/manifests", "/logs"} {
// should return OK - actual result should be tested elsewhere
test.TestRoute(t, handler, false, "GET", fmt.Sprintf("/api/image-builder-composer/v2/composes/%s%s", finalizeID, path), ``, http.StatusOK, "*")

View file

@ -11,9 +11,10 @@ import (
"github.com/golang-jwt/jwt/v4"
"github.com/google/uuid"
"github.com/openshift-online/ocm-sdk-go/authentication"
"github.com/osbuild/osbuild-composer/pkg/jobqueue"
"github.com/stretchr/testify/require"
"github.com/osbuild/osbuild-composer/pkg/jobqueue"
"github.com/osbuild/osbuild-composer/internal/cloudapi/v2"
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
"github.com/osbuild/osbuild-composer/internal/test"
@ -125,14 +126,12 @@ func jobRequest() string {
%q,
%q,
%q,
%q,
%q
],
"arch": %q
}`,
worker.JobTypeKojiInit,
worker.JobTypeOSBuild,
worker.JobTypeOSBuildKoji,
worker.JobTypeKojiFinalize,
worker.JobTypeDepsolve,
test_distro.TestArch3Name)
@ -252,7 +251,7 @@ func TestMultitenancy(t *testing.T) {
c := composes[i]
// We have to run 2 jobs for S3 composes (depsolve, osbuild)
// 4 jobs for koji composes (depsolve, koji-init, osbuild-koji, koji-finalize)
// 4 jobs for koji composes (depsolve, koji-init, osbuild, koji-finalize)
numjobs := 2
if c.koji {
numjobs = 4