-
Notifications
You must be signed in to change notification settings - Fork 0
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
Create CI for building word-count applications #19
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
40a80d4
Test build and test stages
irux 003348c
Test change of directory
irux b087abe
Rollback
irux 743b209
Change gitignore
irux 39028bd
Add wrapper again
irux 279cc44
Test images
irux 9cfd202
Change for env variable
irux 5206c21
Fix replacement
irux 04ff945
Test publish
irux 3b1152a
Fix verification
irux ee27b9c
Fix load
irux 3ade98f
Add run id for the image tag
irux 014e89d
Add release
irux b8f55da
Remove upload and download of images
irux 15e851e
Rename stage
irux b0ee4b8
Rename stage
irux 142e87a
Change to jib command line only
irux 6aeb0e7
Fix end if
irux b324bc5
Add action for the jib
irux 87c1e73
Move to actions
irux d8a817b
Delete if for always there build
irux 2ea08b4
Test metadata docker
irux 2543294
Test without images param
irux de985e9
Disable other jobs
irux c190681
Comment temporary
irux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
working-directory: | ||
description: "working directory to run the commands" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Build 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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Build, Test and Publish | ||
|
||
on: | ||
push: | ||
tags: [ '**' ] | ||
branches: [ '**' ] | ||
|
||
env: | ||
DOCKER_REGISTRY: bakdata | ||
SENTENCE_PRODUCER_IMAGE_NAME: kpops-demo-sentence-producer | ||
WORD_COUNT_APPLICATION_IMAGE_NAME: kpops-demo-word-count-app | ||
WORKING_DIRECTORY_APP: "./word-count" | ||
|
||
|
||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-22.04 | ||
if: false | ||
steps: | ||
- name: Build | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
gradle-version: "wrapper" | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
test: | ||
if: false | ||
name: Test | ||
runs-on: ubuntu-22.04 | ||
needs: build | ||
|
||
steps: | ||
- name: Test | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
gradle-version: "wrapper" | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
build-and-publish-jib: | ||
name: Build and publish images | ||
runs-on: ubuntu-22.04 | ||
#needs: test | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
|
||
- name: Set up Gradle | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
gradle-version: "wrapper" | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
tags: | | ||
event=push,type=raw,enable=true,priority=200,prefix=,suffix=,value=pipeline-${{ github.run_id }}-git-{{sha}} | ||
event=pr,type=raw,enable=true,priority=200,prefix=,suffix=,value=pipeline-${{ github.run_id }}-git-{{sha}} | ||
event=tag,type=semver,pattern={{version}} | ||
|
||
|
||
- name: Build SentenceProducer image for tag release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: ./.github/actions/jib-uploader | ||
with: | ||
image: $DOCKER_REGISTRY/$SENTENCE_PRODUCER_IMAGE_NAME | ||
class: com.bakdata.kpops.examples.SentenceProducer | ||
tags: latest,${GITHUB_REF/refs\/tags\//} | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
- name: Build WordCountApplication image for tag release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: ./.github/actions/jib-uploader | ||
with: | ||
image: $DOCKER_REGISTRY/$WORD_COUNT_APPLICATION_IMAGE_NAME | ||
class: com.bakdata.kpops.examples.WordCountApplication | ||
tags: latest,${GITHUB_REF/refs\/tags\//} | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
- name: Build SentenceProducer image | ||
uses: ./.github/actions/jib-uploader | ||
with: | ||
image: $DOCKER_REGISTRY/$SENTENCE_PRODUCER_IMAGE_NAME | ||
class: com.bakdata.kpops.examples.SentenceProducer | ||
tags: ${{ steps.meta.outputs.tags }} | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
- name: Build WordCountApplication image | ||
uses: ./.github/actions/jib-uploader | ||
with: | ||
image: $DOCKER_REGISTRY/$WORD_COUNT_APPLICATION_IMAGE_NAME | ||
class: com.bakdata.kpops.examples.WordCountApplication | ||
tags: ${{ steps.meta.outputs.tags }} | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
|
||
release: | ||
name: Create GitHub release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-22.04 | ||
needs: build-and-publish-jib | ||
|
||
steps: | ||
- name: Release on Github | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
github-username: ${{ secrets.USERNAME }} | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Release | ||
|
||
env: | ||
WORKING_DIRECTORY_APP: "./word-count" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-type: | ||
type: choice | ||
required: true | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Build | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
gradle-version: "wrapper" | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-22.04 | ||
needs: build | ||
|
||
steps: | ||
- name: Test | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
gradle-version: "wrapper" | ||
working-directory: ${{env.WORKING_DIRECTORY_APP}} | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-22.04 | ||
needs: test | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
ref: ${{ github.event.repository.default_branch }} | ||
persist-credentials: false # required for pushing to protected branch later | ||
fetch-depth: 0 # required to build the changelog | ||
|
||
|
||
- name: Release on Github | ||
id: release | ||
uses: bakdata/ci-templates/actions/[email protected] | ||
with: | ||
release-type: ${{ inputs.release-type }} | ||
github-email: ${{ secrets.GH_EMAIL }} | ||
github-username: ${{ secrets.GH_USERNAME }} | ||
github-token: ${{ secrets.GH_TOKEN }} | ||
java-distribution: "microsoft" | ||
java-version: "17" | ||
working-directory: ${{ inputs.working-directory }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,7 @@ | ||
### Java | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
build | ||
bin | ||
.idea | ||
.vscode | ||
.DS_Store | ||
|
||
*.bin | ||
*.lock | ||
.gradle | ||
.* | ||
!.github | ||
!.gitignore | ||
!.gitmodules | ||
word-count/build/ | ||
word-count/out/ | ||
word-count/bin/ |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change the name of this action to
jib
only? The-uploader
is a bit misleading. I thought it would use the upload action of GitHub to upload the tarball.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we don't want to use the artifacts uploader anymore (#19 (comment)) this action already push to the docker repository