Skip to content

Commit

Permalink
MINOR: Add documentation for docker image github actions (apache#14952)
Browse files Browse the repository at this point in the history
Reviewers: Manikumar Reddy <[email protected]>
  • Loading branch information
VedarthConfluent authored Dec 7, 2023
1 parent 522c286 commit e610767
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docker_promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Promote RC Docker Image
name: Promote Release Candidate Docker Image

on:
workflow_dispatch:
inputs:
rc_docker_image:
description: RC docker image that needs to be promoted to apache/kafka
description: RC docker image that needs to be promoted (Example:- apache/kafka:3.6.0-rc0)
required: true
promoted_docker_image:
description: Docker image name of the promoted image
description: Docker image name of the promoted image (Example:- apache/kafka:3.6.0)
required: true

jobs:
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Copy RC Image to apache/kafka
uses: imjasonh/[email protected]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker_rc_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build and Push RC Docker Image
name: Build and Push Release Candidate Docker Image

on:
workflow_dispatch:
Expand All @@ -24,7 +24,7 @@ on:
options:
- "jvm"
rc_docker_image:
description: RC docker image that needs to be built and pushed to Dockerhub
description: RC docker image that needs to be built and pushed to Dockerhub (Example:- apache/kafka:3.6.0-rc0)
required: true
kafka_url:
description: Kafka url to be used to build the docker image
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Release the RC docker image
run: |
Expand Down
39 changes: 35 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Docker Images

This directory contains scripts to build, test, push and promote docker image for kafka.

Repository Setup
----------------
Make sure the `DOCKERHUB_USER` and `DOCKERHUB_TOKEN` secrets are added and made available to Github Actions in Github Repository settings. This is required for pushing the docker image.

Local Setup
-----------
Make sure you have python (>= 3.7.x) and java (>= 17) (java needed only for running tests) installed before running the tests and scripts.
Expand Down Expand Up @@ -41,8 +45,8 @@ image_type: jvm
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
```

Creating a release
------------------
Creating a Release Candidate
----------------------------
- `docker_release.py` script builds a multi-architecture image and pushes it to provided docker registry.
- Ensure you are logged in to the docker registry before triggering the script.
- kafka binary tarball url along with image name (in the format `<registry>/<namespace>/<image_name>:<image_tag>`) and type is needed to build the image. For detailed usage description check `python docker_release.py --help`.
Expand All @@ -57,10 +61,37 @@ python docker_release.py kafka/test:3.6.0 --kafka-url https://archive.apache.org

Please note that we use docker buildx for preparing the multi-architecture image and pushing it to docker registry. It's possible to encounter build failures because of buildx. Please retry the command in case some buildx related error occurs.

Promoting a release
-------------------
Creating a Release Candidate using github actions
-------------------------------------------------
This is the recommended way to push an RC docker image.
Go to `Build and Push Release Candidate Docker Image` Github Actions Workflow.
Choose the `image_type` and and provide `kafka_url` that needs to be containerised in the `rc_docker_image` that will be pushed to github.

Example:-
If you want to push a jvm image which contains kafka from https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz to dockerhub under the namespace apache, repo name as kafka and image tag as 3.6.0-rc1 then following values need to be added in Github Actions Workflow:-
```
image_type: jvm
kafka_url: https://archive.apache.org/dist/kafka/3.6.0/kafka_2.13-3.6.0.tgz
rc_docker_image: apache/kafka:3.6.0-rc0
```

Promoting a Release Candidate
-----------------------------
`docker_promote.py` provides an interactive way to pull an RC Docker image and promote it to required dockerhub repo.

Promoting a Release Candidate using github actions
--------------------------------------------------
This is the recommended way to promote an RC docker image.
Go to `Promote Release Candidate Docker Image` Github Actions Workflow.
Choose the RC docker image (`rc_docker_image`) that you want to promote and where it needs to be pushed to (`promoted_docker_image`), i.e. the final docker image release.

Example:-
If you want to promote apache/kafka:3.6.0-rc0 RC docker image to apache/kafka:3.6.0 then following parameters can be provided to the workflow.
```
rc_docker_image: apache/kafka:3.6.0-rc0
promoted_docker_image: apache/kafka:3.6.0
```

Using the image in a docker container
-------------------------------------
- The image uses the kafka downloaded from provided kafka url
Expand Down

0 comments on commit e610767

Please sign in to comment.