Skip to content

Update your Kubernetes image tags with ease! 🤓

License

Notifications You must be signed in to change notification settings

Charlyzzz/update-k8s-image

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

update-k8s-image action

This action updates a container image tag in a Kubernetes deployment file.

Usage

- id: update-image
  uses: Charlyzzz/update-k8s-image
  with:
    manifest-path: path/to/deployment.yaml
    new-image-tag: latest
    name: my-backend

# Example of using the output
- id: test
  run: curl ${{ steps.update-image.outputs.old-image-tag }}

Inputs

Inputs

  • manifest-path: (Required) Deployment file's path.

  • new-image-tag: (Optional) Value to use as new tag. Defaults to ${{ github.sha }}.

  • container-name: (Required) Name of the container that uses the image. This parameter is used to target only one container.

Outputs

  • old-image-tag: Image tag before replacement.

Scenarios

Set backend version to latest

### path/to/my/deployment.yaml ###
#
#    apiVersion: apps/v1
#    kind: Deployment
#    spec:
#      replicas: 1
#      selector:
#        matchLabels:
#          app: my-app
#      template:
#        metadata:
#          labels:
#            app: my-app
#        spec:
#          containers:
#            - name: backend
#              image: my-registry/backend:1.0
#              ports:
#                - containerPort: 80
#            - name: sidecar
#              image: sidecar:2.0
#              ports:
#                - containerPort: 9999
steps:
  - uses: Charlyzzz/update-k8s-image
    with:
      manifest-path: path/to/my/deployment.yaml
      new-image-tag: latest
      name: backend

License

The scripts and documentation in this project are released under the MIT License