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

WIP: Add script to update dockerfiles on a PR merge #466

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bharathappali
Copy link
Collaborator

As part of dockerfiles generation automation process, I would like to add this script to the repo to semi automate the process of updating dockerfiles after a PR with dockerfile changes gets merged.

Why its a semi automation ?
User who runs this script needs to manually raise a PR for updating the dockerfiles. The generation of dockerfiles is only automated.

What would be a better solution ?
triggering a automatic dockerfiles update after a PR merge via github actions or github webhooks will be an ideal solution. Till we explore a possible fix, this script can be handy

@dinogun Can i have your views on it ?

Signed-off-by: bharathappali bharath.appali@gmail.com

git branch -D ${BRANCH_NAME}
git checkout -b ${BRANCH_NAME}
fi
source update_all.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a variable to only update release build Dockerfiles (and not nightly ones)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can now pass the first arg as releases or nightly, if nothing is passed it updates both releases and nightly

git checkout -b ${BRANCH_NAME}
fi
source update_all.sh
git add 8/ 9/ 10/ 11/ 12/ 13/ 14/ 15/
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to happen based on supported_versions available in common_functions.sh

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

made changes accordingly

echo -e "${BRED}CAUTION${NOCOLOR} : Please run this script after saving your work (commiting) as ${RED}it may mess up your changes${NOCOLOR}."
echo ""
echo ""
read -r -p "Do you want to proceed ? [y/N] " USER_RESPONSE
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need a non-interactive mode so that we can call this from a jenkins job based on a trigger

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed the non-interactive mode

@karianna karianna added this to To do in openjdk-docker via automation Nov 17, 2020
@karianna karianna added this to the November 2020 milestone Nov 17, 2020
@karianna karianna moved this from To do to In Progress in openjdk-docker Nov 17, 2020
@karianna karianna modified the milestones: November 2020, December 2020 Dec 1, 2020
@bharathappali bharathappali force-pushed the check-merge-script branch 2 times, most recently from 2ce9e98 to d2d981e Compare December 2, 2020 07:59
@karianna karianna requested a review from dinogun December 2, 2020 12:27
@@ -43,7 +45,11 @@ do
btypes=$(parse_vm_entry "${vm}" "${version}" "${package}" "${os}" "Type:")
dir=$(parse_vm_entry "${vm}" "${version}" "${package}" "${os}" "Directory:")

for build in ${builds}
if [ ! -z "${build_arg}" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like you have spaces instead of tabs here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed spaces to tabs

update_all.sh Outdated
@@ -17,6 +17,11 @@ set -o pipefail
# shellcheck source=common_functions.sh
source ./common_functions.sh

if [ -n "$1" ]; then
build_arg="$1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

spaces here ... should be tabs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed spaces to tabs

@@ -0,0 +1,125 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe you need to fix your editor ... this entire file uses spaces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated the file to have tabs instead of spaces

fi
source update_all.sh releases
git add ${supported_versions}
git commit -m "Updating dockerfiles via update_dockerfiles_on_merge.sh script" -s
Copy link
Collaborator

Choose a reason for hiding this comment

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

The commit message should have a date and timestamp along with the PR number, something like

Timestamp: Auto-updating dockerfiles for PR #"${PR_NUMBER}"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added custom timestamp : git commit -m "$(date '+%d-%m-%Y %H:%M:%S') : Auto-updating dockerfiles for PR #${PR_NUM}" -s

Signed-off-by: bharathappali <bharath.appali@gmail.com>
@dinogun dinogun changed the title WIP: Added script to update dockerfiles on a PR merge WIP: Add script to update dockerfiles on a PR merge Jan 22, 2021
@karianna karianna modified the milestones: February 2021, March 2021 Mar 1, 2021
@gdams
Copy link
Member

gdams commented Apr 29, 2021

@bharathappali I think I've got a fully automated solution here: #558

@karianna karianna modified the milestones: March 2021, April 2021, May 2021 May 5, 2021
@karianna karianna modified the milestones: May 2021, June 2021 Jun 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
openjdk-docker
  
In Progress
Development

Successfully merging this pull request may close these issues.

None yet

4 participants