@@ -127,7 +127,7 @@ aws_login() {
127127
128128 if [[ ${ACCOUNT} == " prod" ]]; then
129129 aws-vault exec sso-prod-lambda-admin -- ${cfg[@]}
130- elif [[ ${ACCOUNT} == " datadog" ]]; then
130+ elif [[ ${ACCOUNT} == " datadog" ]]; then
131131 aws-vault exec sso-prod-lambda-admin -- ${cfg[@]}
132132 else
133133 if [[ ${DEPLOY_TO_SERVERLESS_SANDBOX:- } == " true" ]]; then
@@ -157,14 +157,14 @@ datadog_release() {
157157 ./tools/build_bundle.sh " ${FORWARDER_VERSION} "
158158 fi
159159
160- # Upload the bundle to S3 instead of GitHub for a org 2 release
160+ # Upload the bundle to S3 instead of GitHub for a org 2 release
161161 log_info " Uploading a non-public version of Forwarder to S3..."
162162 aws_login aws s3 cp " ${BUNDLE_PATH} " " s3://${BUCKET} /aws/forwarder-zip/aws-dd-forwarder-${FORWARDER_VERSION} .zip"
163163
164164 # set urls
165165 TEMPLATE_URL=" https://${BUCKET} .s3.amazonaws.com/aws/forwarder/${FORWARDER_VERSION} .yaml"
166166 FORWARDER_SOURCE_URL=" s3://${BUCKET} /aws/forwarder-zip/aws-dd-forwarder-${FORWARDER_VERSION} .zip"
167-
167+
168168 # don't publish layers we'll use the zip copier instead
169169}
170170
@@ -208,6 +208,7 @@ prod_release() {
208208 fi
209209
210210 # Get the latest code
211+ git checkout master
211212 git pull origin master
212213
213214 log_info " Bumping the version number to ${FORWARDER_VERSION} ..."
@@ -218,11 +219,28 @@ prod_release() {
218219 yq --inplace " .Mappings.Constants.DdForwarder.LayerVersion |= \" ${LAYER_VERSION} \" " " template.yaml"
219220
220221 if ! git diff --quiet; then
221- log_info " Committing version number change..."
222+ BRANCH_NAME=" layer_${LAYER_VERSION} "
223+
224+ log_info " Opening pull-request version number change on branch ${BRANCH_NAME} ..."
225+ git checkout -b " ${BRANCH_NAME} "
226+
222227 git add " settings.py" " template.yaml"
223228 git commit --signoff --message " ci(release): Update version from ${CURRENT_VERSION} to ${FORWARDER_VERSION} "
229+
230+ hub pull-request --browse --message " Update version from ${CURRENT_VERSION} to ${FORWARDER_VERSION} "
231+
232+ if ! user_confirm " Review and merge the pull-request before continuing. Continue" ; then
233+ log_error " Aborting... To restart, run the script with PROD_GITHUB_RESTART=true env variable."
234+ fi
224235 fi
225236
237+ prod_asset_push
238+ }
239+
240+ prod_asset_push () {
241+ git checkout master
242+ git pull origin master
243+
226244 GIT_COMMIT=" $( git rev-parse HEAD) "
227245 log_info " Using ${GIT_COMMIT} commit as the release target..."
228246
@@ -237,9 +255,6 @@ prod_release() {
237255 log_info " Uploading layers..."
238256 ./tools/publish_prod.sh " ${LAYER_VERSION} " " ${FORWARDER_VERSION} "
239257
240- log_info " Pushing version number change..."
241- git push origin master
242-
243258 # Create a GitHub release
244259 log_info " Releasing aws-dd-forwarder-${FORWARDER_VERSION} , targetting commit ${GIT_COMMIT} , to GitHub..."
245260 hub release create -a " ${BUNDLE_PATH} " -m " aws-dd-forwarder-${FORWARDER_VERSION} " -t " ${GIT_COMMIT} " " aws-dd-forwarder-${FORWARDER_VERSION} "
@@ -264,7 +279,11 @@ log_info "Validating template.yaml..."
264279aws_login aws cloudformation validate-template --template-body " file://template.yaml"
265280
266281if [[ ${ACCOUNT} == " prod" ]]; then
267- prod_release
282+ if [[ ${PROD_GITHUB_RESTART:- } == " true" ]]; then
283+ prod_asset_push
284+ else
285+ prod_release
286+ fi
268287elif [[ ${ACCOUNT} == " datadog" ]]; then
269288 datadog_release
270289else
0 commit comments