Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jib-uploader action #175

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions actions/java-gradle-build-push-jib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# jib-uploader

- [Description](https://github.com/bakdata/ci-templates/tree/main/docs/descriptions/actions/java-gradle-build-push-jib)
- [References](https://github.com/bakdata/ci-templates/tree/main/docs/references/actions/java-gradle-build-push-jib)
29 changes: 29 additions & 0 deletions actions/java-gradle-build-push-jib/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Build and upload Jib "
description: "Build the Jib image and upload it to the image repository"

inputs:
image:
description: "The image name with its repository name"
required: true
tags:
description: "The tags to use to release the image"
required: true
class:
description: "The entrypoint class to be used for the image"
required: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this optional. We often times define it in the build.gradle file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See discussion above

working-directory:
description: "Working directory to run the commands"
required: true

runs:
using: "composite"
steps:
- name: Build & push Docker image
run: |
./gradlew jib \
--info --stacktrace \
--image=${{ inputs.image }} \
-Djib.container.mainClass=${{ inputs.class }} \
-Djib.to.tags=${{ inputs.tags }}
shell: bash
working-directory: ${{ inputs.working-directory }}
40 changes: 40 additions & 0 deletions docs/actions/java-gradle-build-push-jib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Description java-gradle-build-push-jib composite action

This composite action utilizes Jib to efficiently build a container image and automatically upload it to the referenced container repository.

## Usage

```yaml
- name: Build SentenceProducer image for tag release
uses: bakdata/ci-templates/actions/jib-uploader@main
with:
image: my-docker-registry/my-docker-image
class: org.example.MyClass
tags: latest,${GITHUB_REF/refs\/tags\//}
working-directory: "./"
```

## References

### Inputs

<!-- AUTO-DOC-INPUT:START - Do not remove or modify this section -->

| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
| ----------------- | ------ | -------- | ------- | --------------------------------------------- |
| class | string | true | | The entrypoint class to be used for the image |
| image | string | true | | The image name with its repository name |
| tags | string | true | | The tags to use to release the image |
| working-directory | string | true | | Working directory to run the commands |

<!-- AUTO-DOC-INPUT:END -->

### Outputs

<!-- AUTO-DOC-OUTPUT:START - Do not remove or modify this section -->

No outputs.

<!-- AUTO-DOC-OUTPUT:END -->

### Secrets
Loading