Compare commits
4 commits
abcc6988a4
...
6d2e7d3b92
Author | SHA1 | Date | |
---|---|---|---|
6d2e7d3b92 | |||
6b5fb372e4 | |||
cc9b4b7b4c | |||
d0ba75af22 |
4 changed files with 75 additions and 7 deletions
25
.woodpecker/oci-image-build.yml
Normal file
25
.woodpecker/oci-image-build.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
matrix:
|
||||||
|
PLATFORM:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
labels:
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
build:
|
||||||
|
image: woodpeckerci/plugin-docker-buildx:2.3.0
|
||||||
|
group: build
|
||||||
|
settings:
|
||||||
|
registry: rg.fr-par.scw.cloud/hamburghammer
|
||||||
|
username: nologin
|
||||||
|
password:
|
||||||
|
from_secret: docker_token
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
target: setup-image
|
||||||
|
repo: rg.fr-par.scw.cloud/hamburghammer/scaleway-delete-image-plugin/plugin
|
||||||
|
tags: latest
|
||||||
|
pull_image: true
|
||||||
|
platforms: ${PLATFORM}
|
||||||
|
when:
|
||||||
|
- branch: main
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
FROM docker.io/golang:1.21.5 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
# create a cache
|
||||||
|
COPY go.* /src/
|
||||||
|
RUN go mod download
|
||||||
|
# compile
|
||||||
|
COPY * /src/
|
||||||
|
RUN CGO_ENABLED=0 go build -o /scaleway-delete-image-plugin .
|
||||||
|
|
||||||
|
FROM alpine:3.19
|
||||||
|
RUN apk -Uuv add curl ca-certificates
|
||||||
|
COPY --from=build /src/scaleway-delete-image-plugin /scaleway-delete-image-plugin
|
||||||
|
ENTRYPOINT /scaleway-delete-image-plugin
|
29
README.md
Normal file
29
README.md
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
# Scaleway-Delete-Image-Plugin
|
||||||
|
|
||||||
|
Is a plugin for Woodpecker CI to delete an image tag from the Scaleway container
|
||||||
|
registry.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
delete-tag:
|
||||||
|
image: rg.fr-par.scw.cloud/hamburghammer/scaleway-delete-image-plugin/plugin
|
||||||
|
secrets: [token]
|
||||||
|
settings:
|
||||||
|
token:
|
||||||
|
from_secret: scaleway_token
|
||||||
|
image-name: foo/bar
|
||||||
|
tag: latest
|
||||||
|
region: fr-par
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Required options:
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ---------- | --------------------------------------- |
|
||||||
|
| token | Token for the Scaleway API |
|
||||||
|
| image-name | The image which should be deleted |
|
||||||
|
| tag | The tag that should be deleted |
|
||||||
|
| region | The Scaleway region the registry exists |
|
15
main.go
15
main.go
|
@ -27,25 +27,26 @@ type Plugin struct {
|
||||||
func (p *Plugin) Flags() []cli.Flag {
|
func (p *Plugin) Flags() []cli.Flag {
|
||||||
return []cli.Flag{
|
return []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "Scaleway API token",
|
Name: "token",
|
||||||
|
Usage: "Token for the Scaleway API",
|
||||||
EnvVars: []string{"PLUGIN_TOKEN"},
|
EnvVars: []string{"PLUGIN_TOKEN"},
|
||||||
Destination: &p.Settings.Token,
|
Destination: &p.Settings.Token,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "The image name to be deleted",
|
Name: "image-name",
|
||||||
Usage: "hamburghammer/dchat/setup-image",
|
Usage: "The image from which the tag should be deleted",
|
||||||
EnvVars: []string{"PLUGIN_IMAGE_NAME"},
|
EnvVars: []string{"PLUGIN_IMAGE_NAME"},
|
||||||
Destination: &p.Settings.ImageName,
|
Destination: &p.Settings.ImageName,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "Tag of the image",
|
Name: "tag",
|
||||||
Usage: "hamburghammer/dchat/setup-image",
|
Usage: "The tag that should be deleted",
|
||||||
EnvVars: []string{"PLUGIN_IMAGE_NAME"},
|
EnvVars: []string{"PLUGIN_IMAGE_NAME"},
|
||||||
Destination: &p.Settings.Tag,
|
Destination: &p.Settings.Tag,
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "The Scaleway region from the registry",
|
Name: "region",
|
||||||
Usage: "fr-par",
|
Usage: "The Scaleway region the registry exists",
|
||||||
EnvVars: []string{"PLUGIN_REGION"},
|
EnvVars: []string{"PLUGIN_REGION"},
|
||||||
Destination: &p.Settings.Region,
|
Destination: &p.Settings.Region,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue