MINOR: Add documentation for docker image github actions (#14952)

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>
This commit is contained in:
Vedarth Sharma 2023-12-07 16:28:59 +05:30 committed by GitHub
parent 522c2864cd
commit e610767f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 11 deletions

View File

@ -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:
@ -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/setup-crane@v0.1

View File

@ -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:
@ -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
@ -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: |

View File

@ -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.
@ -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`.
@ -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