Skip to content

Commit a7d009a

Browse files
committed
fix: remove tag based update logic and only use digests
1 parent 6e7bee4 commit a7d009a

File tree

4 files changed

+339
-482
lines changed

4 files changed

+339
-482
lines changed

backend/internal/api/image_update_handler.go

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package api
22

33
import (
44
"net/http"
5-
"strconv"
65

76
"github.com/gin-gonic/gin"
87
"github.com/ofkm/arcane-backend/internal/dto"
@@ -25,8 +24,6 @@ func NewImageUpdateHandler(group *gin.RouterGroup, imageUpdateService *services.
2524
apiGroup.POST("/check-batch", handler.CheckMultipleImages)
2625
apiGroup.GET("/check-all", handler.CheckAllImages)
2726
apiGroup.GET("/summary", handler.GetUpdateSummary)
28-
apiGroup.GET("/versions", handler.GetImageVersions)
29-
apiGroup.POST("/compare", handler.CompareVersions)
3027
}
3128
}
3229

@@ -151,63 +148,3 @@ func (h *ImageUpdateHandler) GetUpdateSummary(c *gin.Context) {
151148
"data": summary,
152149
})
153150
}
154-
155-
func (h *ImageUpdateHandler) GetImageVersions(c *gin.Context) {
156-
imageRef := c.Query("imageRef")
157-
if imageRef == "" {
158-
c.JSON(http.StatusBadRequest, gin.H{
159-
"success": false,
160-
"error": "imageRef query parameter is required",
161-
})
162-
return
163-
}
164-
165-
limitStr := c.DefaultQuery("limit", "20")
166-
limit, err := strconv.Atoi(limitStr)
167-
if err != nil {
168-
c.JSON(http.StatusBadRequest, gin.H{
169-
"success": false,
170-
"error": "Invalid limit parameter",
171-
})
172-
return
173-
}
174-
175-
versions, err := h.imageUpdateService.GetAvailableVersions(c.Request.Context(), imageRef, limit)
176-
if err != nil {
177-
c.JSON(http.StatusInternalServerError, gin.H{
178-
"success": false,
179-
"error": "Failed to get image versions: " + err.Error(),
180-
})
181-
return
182-
}
183-
184-
c.JSON(http.StatusOK, gin.H{
185-
"success": true,
186-
"data": versions,
187-
})
188-
}
189-
190-
func (h *ImageUpdateHandler) CompareVersions(c *gin.Context) {
191-
var req dto.CompareVersionRequest
192-
if err := c.ShouldBindJSON(&req); err != nil {
193-
c.JSON(http.StatusBadRequest, gin.H{
194-
"success": false,
195-
"error": "Invalid request format",
196-
})
197-
return
198-
}
199-
200-
comparison, err := h.imageUpdateService.CompareVersions(c.Request.Context(), req.ImageRef, req.CurrentVersion, req.TargetVersion)
201-
if err != nil {
202-
c.JSON(http.StatusInternalServerError, gin.H{
203-
"success": false,
204-
"error": "Failed to compare versions: " + err.Error(),
205-
})
206-
return
207-
}
208-
209-
c.JSON(http.StatusOK, gin.H{
210-
"success": true,
211-
"data": comparison,
212-
})
213-
}

backend/internal/dto/image_update_dto.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,12 @@ type ImageUpdateSummaryResponse struct {
2323
TotalImages int `json:"totalImages"`
2424
ImagesWithUpdates int `json:"imagesWithUpdates"`
2525
DigestUpdates int `json:"digestUpdates"`
26-
TagUpdates int `json:"tagUpdates"`
2726
ErrorsCount int `json:"errorsCount"`
2827
}
2928

30-
type ImageVersionsResponse struct {
31-
ImageRef string `json:"imageRef"`
32-
Current string `json:"current"`
33-
Versions []string `json:"versions"`
34-
Latest string `json:"latest,omitempty"`
35-
}
36-
37-
type VersionComparisonResponse struct {
38-
CurrentVersion string `json:"currentVersion"`
39-
TargetVersion string `json:"targetVersion"`
40-
IsNewer bool `json:"isNewer"`
41-
UpdateType string `json:"updateType"`
42-
ChangeLevel string `json:"changeLevel"`
43-
}
44-
4529
type BatchImageUpdateRequest struct {
4630
ImageRefs []string `json:"imageRefs" binding:"required"`
4731
Credentials []ContainerRegistryCredential `json:"credentials,omitempty"`
4832
}
4933

5034
type BatchImageUpdateResponse map[string]*ImageUpdateResponse
51-
52-
type CompareVersionRequest struct {
53-
CurrentVersion string `json:"currentVersion" binding:"required"`
54-
TargetVersion string `json:"targetVersion" binding:"required"`
55-
ImageRef string `json:"imageRef" binding:"required"`
56-
}

0 commit comments

Comments
 (0)