Skip to content

Commit

Permalink
chore: check coverage image with dive
Browse files Browse the repository at this point in the history
closes #11
  • Loading branch information
ialejandro committed Aug 15, 2024
1 parent 275fec7 commit eec1aef
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 25 deletions.
52 changes: 41 additions & 11 deletions .github/workflows/check-changes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,24 @@ jobs:
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Get current tag
id: current_release
run: |
# cc_tag
# cc_release
cc_current_release=$(grep "ARG CC_TAG" Dockerfile | cut -d '=' -f 2)
echo "cc_current_release=$cc_current_release" >> $GITHUB_OUTPUT
# cc_ui_tag
# cc_ui_release
cc_ui_current_release=$(grep "ARG CC_TAG_UI" Dockerfile | cut -d '=' -f 2)
echo "cc_ui_current_release=$cc_ui_current_release" >> $GITHUB_OUTPUT
# iam_tag
# iam_release
iam_current_release=$(grep "ARG AWS_MSK_IAM_AUTH_VERSION" Dockerfile | cut -d '=' -f 2)
echo "iam_current_release=$iam_current_release" >> $GITHUB_OUTPUT
Expand All @@ -41,20 +47,20 @@ jobs:
- name: Get latest tag
id: latest_release
run: |
# cc_tag
# cc_release
cc_latest_release=$(grep "ARG CC_TAG" Dockerfile | cut -d '=' -f 2)
echo "cc_latest_release=$cc_latest_release" >> $GITHUB_OUTPUT
# cc_ui_tag
# cc_ui_release
cc_ui_latest_release=$(grep "ARG CC_TAG_UI" Dockerfile | cut -d '=' -f 2)
echo "cc_ui_latest_release=$cc_ui_latest_release" >> $GITHUB_OUTPUT
# iam_tag
# iam_release
iam_latest_release=$(grep "ARG AWS_MSK_IAM_AUTH_VERSION" Dockerfile | cut -d '=' -f 2)
echo "iam_latest_release=$iam_latest_release" >> $GITHUB_OUTPUT
# complete tag
echo "complete_tag=cc$cc_latest_release-iam$iam_latest_release" >> $GITHUB_OUTPUT
# complete_tag
echo "complete_release=cc$cc_latest_release-iam$iam_latest_release" >> $GITHUB_OUTPUT
- name: Check if exists changes
id: check_changes
Expand Down Expand Up @@ -98,16 +104,40 @@ jobs:
echo -e "$body" > pr-output.log
- name: "Build and push Docker image"
uses: docker/build-push-action@v6
if: steps.check_changes.outputs.release_changed == 'true'
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
context: .
platforms: linux/amd64
push: false
tags: kafka-cruise-control-$GITHUB_JOB

- name: Show changes
if: steps.check_changes.outputs.release_changed == 'true'
run: |
# install dive
mkdir dive && cd dive
wget https://github.com/wagoodman/dive/releases/download/v${{ vars.DIVE_VERSION }}/dive_${{ vars.DIVE_VERSION }}_linux_amd64.tar.gz
tar xzvf dive_${{ vars.DIVE_VERSION }}_linux_amd64.tar.gz
cd ..
# dive
echo -e "\n## Dive output\n" >> pr-output.log
./dive/dive -t kafka-cruise-control-${{ env.GITHUB_JOB }} >> pr-output.log
- name: Create PR changes
if: steps.check_changes.outputs.release_changed == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT_GITHUB }}
commit-message: "feat: new cruise-control version ${{ steps.latest_release.outputs.complete_tag }}"
commit-message: "feat: new cruise-control version ${{ steps.latest_release.outputs.complete_release }}"
signoff: false
branch: feat/upgrade-cruise-control-${{ steps.latest_release.outputs.complete_tag }}
branch: feat/upgrade-cruise-control-${{ steps.latest_release.outputs.complete_release }}
delete-branch: true
title: '[cruise-control] new release: ${{ steps.latest_release.outputs.complete_tag }}'
title: '[cruise-control] new release: ${{ steps.latest_release.outputs.complete_release }}'
body-path: pr-output.log
labels: |
auto-pr-bump-version
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pr-output.log
dive
dive/*
42 changes: 41 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
TODO
# How to contribute to Cruise Control

This document provides guidelines for contributing to the *Cruise Control* project.

## How can I contribute?

### Did you find a bug?

* **Ensure the bug has not already been reported** by searching on GitHub under [Issues](https://github.com/devops-ia/kafka-cruise-control/issues).
* If you cannot find an open issue addressing the problem, [open a new one](https://github.com/devops-ia/kafka-cruise-control/issues/new). Include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the unexpected behavior.
* Use the relevant bug report templates to create the issue, if available.

### Do you intend to add a new feature or change an existing one?

* Please discuss first ([open an issue](https://github.com/devops-ia/kafka-cruise-control/issues)) before starting any significant pull request (e.g., implementing features, refactoring code) to avoid spending time on something that might not be merged.
* Adhere to the project's coding conventions (indentation, accurate comments, etc.) and any other requirements (such as test coverage, documentation).

## Styleguides

### YAML Styleguide

All YAML files must adhere to the following style guide:

* Indentation: Use 2 spaces for indentation.
* No trailing spaces.
* Use hyphens for list items.
* Use camelCase for key names.
* Ensure there are no syntax errors.

Additional rules:

* Always use double quotes for strings.
* Keep lines to a maximum of 80 characters.
* Ensure proper alignment of nested elements.

### Git Commit Messages

* Use the present tense ("Add feature" not "Added feature").
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
* Limit the first line to 72 characters or less.
* Reference issues and pull requests liberally after the first line.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ RUN wget https://github.com/aws/aws-msk-iam-auth/releases/download/v${AWS_MSK_IA
FROM amazoncorretto:${OPENJDK_VERSION}

LABEL maintainer="Iván Alejandro Marugán <hello@ialejandro.rocks>" \
description="Cruise Control for Apache Kafka (https://github.com/linkedin/cruise-control)" \
version="1.0.0"
description="Cruise Control for Apache Kafka (https://github.com/linkedin/cruise-control)"

RUN mkdir -p /cruise-control/cruise-control-ui
COPY --from=base /cruise-control/config /cruise-control/config
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 DevOps Solutions
Copyright (c) 2024 DevOps Solutions

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Default versions:

* Cruise Control: `2.5.138`
* Cruise Control UI: `0.4.0`
* AWS IAM Auth: `2.1.1`
* AWS IAM Auth: `2.2.0`

## Image details (from dive)

Expand All @@ -26,7 +26,7 @@ You can reproduce this summary with [`dive`](https://github.com/wagoodman/dive):
dive build -t <tag-name> .
```

## Quick start!
## Quick start

[**Available images**](https://hub.docker.com/r/devopsiaci/cruise-control/tags)

Expand All @@ -41,10 +41,13 @@ docker run --name <container-name> \
-p 9090:9090 \
-v config:/cruise-control/config \
-v config/config.csv:/cruise-control/config \
jdk11-cc2.5.138
jdk17-cc2.5.138-iam2.2.0
```

## Build your custom image!
* More samples: [linkedin/cruise-control - configs](https://github.com/linkedin/cruise-control/tree/2.5.138/config)
* More info: [linkedin/cruise-control - wiki](https://github.com/linkedin/cruise-control/wiki/)

## Build your custom image

**REMEMBER**: Kafka and Cruise Control must be have the same Java running version. If you want other Java version check "Change Java version" and rebuild the image. [**All allowed tags**](https://hub.docker.com/r/devopsiaci/cruise-control/tags).

Expand Down Expand Up @@ -73,7 +76,7 @@ docker run --name <container-name> \
<tag-name>
```

* More samples: [linkedin/cruise-control - configs](https://github.com/linkedin/cruise-control/tree/migrate_to_kafka_2_4/config)
* More samples: [linkedin/cruise-control - configs](https://github.com/linkedin/cruise-control/tree/2.5.138/config)
* More info: [linkedin/cruise-control - wiki](https://github.com/linkedin/cruise-control/wiki/)

## Configure Nginx
Expand Down Expand Up @@ -115,9 +118,5 @@ docker build --build-arg OPENJDK_VERSION=<version> -t <image-name> . # example v
You can change the default Cruise Control version and Cruise Control UI version with `CC_TAG` and `CC_UI_TAG` arguments (please check [environment-requirements](https://github.com/linkedin/cruise-control#environment-requirements) and [compatibilities](https://github.com/linkedin/cruise-control#known-compatibility-issues))

```command
docker build --build-arg CC_TAG=<version> --build-arg CC_UI_TAG=<version> -t <image-name> . # example CC_TAG=2.5.137 and CC_UI_TAG=0.4.0
docker build --build-arg CC_TAG=<version> --build-arg CC_UI_TAG=<version> -t <image-name> . # example CC_TAG=2.5.138 and CC_UI_TAG=0.4.0
```

## Contributing

We're happy if you want open and issue or a new feature :)

0 comments on commit eec1aef

Please sign in to comment.