Skip to content

Commit

Permalink
added support for labels, for supporting image expiration (janus-idp#495
Browse files Browse the repository at this point in the history
)

* added support for labels, for supporting image expiration
* Update cron to run at 4:00 UTC (12:00am ET)
  • Loading branch information
nemerna committed Sep 6, 2023
1 parent fa4fd21 commit 6374999
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .changeset/image-labels-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
<!-- im not sure if we really need a VersionPump since the changes are only related to the CI -->
'app': patch
'backend': patch
---

Implemented Support for Custom Docker Image Labels in GitHub Actions Workflow:

Incorporated functionality to seamlessly manage custom labels for Docker images within the GitHub Actions workflow. The enhancements were made as follows:

1. **Enhanced Action Configuration (`action.yaml`):**
- Introduced the `imageLabels` parameter in the Docker build action configuration.
- The `imageLabels` parameter empowers users to define custom labels for Docker images during the build process.
2. **Improved Workflow Configuration (`nightly.yaml`):**
- Introduced the `imageLabels` parameter in the workflow configuration.
- Illustrative usage: Setting `imageLabels: quay.expires-after=14d` to specify a 14-day expiration for images.
- When executing the nightly workflow, the Docker image will be enriched with the designated labels.

**Usage Guide:**
To leverage the new `imageLabels` parameter, navigate to the workflow configuration (`nightly.yaml`) and modify the `imageLabels` parameter as needed:

```yaml
jobs:
release:
...
steps:
...
- name: Publish
uses: ./.github/actions/docker-build
with:
...
imageLabels: "quay.expires-after=14d" # modify this
push: true

```
5 changes: 5 additions & 0 deletions .github/actions/docker-build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ inputs:
imageTags:
description: The tags to apply to the image
required: true
imageLabels:
description: The labels for the Docker image
required: false
push:
description: Whether to push the image
required: true
Expand Down Expand Up @@ -77,6 +80,8 @@ runs:
images: ${{ inputs.registry }}/${{ inputs.imageName }}
tags: |
${{ inputs.imageTags }}
labels: |
${{ inputs.imageLabels }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Nightly

on:
schedule:
- cron: '0 19 * * *'
- cron: '0 4 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
Expand Down Expand Up @@ -37,4 +37,5 @@ jobs:
imageName: ${{ env.IMAGE_NAME }}
imageTags: |
type=schedule,pattern={{date 'YYYYMMDD'}},prefix=nightly-
imageLabels: quay.expires-after=14d
push: true

0 comments on commit 6374999

Please sign in to comment.