-
Notifications
You must be signed in to change notification settings - Fork 2
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
Split local git operations from github operations #49
base: main
Are you sure you want to change the base?
Conversation
Previously the functions which identify the changes to make to the target repository and which apply them to get a patch were intermingled with the functions interacting with github. This meant that testing the file and patching operations required github credentials. This patch separates out the file operations into their own command, `patch-target.sh`, which is called with the relevant parameters by `entrypoint.sh`. It also makes some additions to the error handling in the `update-from-template` command to make debugging a little easier. Fixes nhs-england-tools#48.
@@ -14,3 +14,4 @@ | |||
.docker | |||
coverage.html | |||
coverage.out | |||
tmp/ |
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.
Do we need to exclude tmp/
if we have this:
temp_dir=$(mktemp -d)
trap "rm -r ${temp_dir}" EXIT
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.
We probably don't want to check in the binary so may need to keep this file.
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.
I would suggest we upload the binary to the the GitHub Release asset when we have the Publish workflow complete in the repository template.
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.
The following line has to be included in the Dockerfile
(right after gpg.sh) for this to work as a GH Action:
COPY --from=builder /github/workspace/patch-target.sh /
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.
We need to keep this file for the GH action to work.
@@ -25,7 +25,6 @@ function docker-build() { | |||
_create-effective-dockerfile | |||
_create-effective-version | |||
docker build \ | |||
--progress=plain \ |
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.
This file comes from the repository template, therefore we probably don't want to change it.
dest_dir=${2:-} | ||
commit_msg=${3:-} | ||
update_binary=${UPDATE_BINARY:-/update-from-template} | ||
update_config_file=${UPDATE_CONFIG_FILE:-/.config.yaml} |
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.
This should be /update-from-template.yaml
rather than /.config.yaml
. It is copied to the root level in the Dockerfile from the project's directory scripts/config/update-from-template.yaml
.
--source-dir $src_dir \ | ||
--destination-dir $dest_dir \ | ||
--app-config-file $update_config_file \ | ||
--template-config-file $dest_dir/scripts/config/.repository-template.yaml \ |
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.
The file name should be repository-template.yaml
instead of .repository-template.yaml
(no dot). The dot prefix is used when files are located at the top level directory. We don't need to do that as we store all the configuration files in the scripts/config
directory.
Description
This patch separates out the file operations into their own command,
patch-target.sh
, which is called with the relevant parameters byentrypoint.sh
.It also makes some additions to the error handling in the
update-from-template
command to make debugging a little easier.Fixes #48.
Context
Previously the functions which identify the changes to make to the target
repository and which apply them to get a patch were intermingled with the
functions interacting with github. This meant that testing the file and
patching operations required github credentials.
Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.