Skip to content

Commit

Permalink
fix for Init Action (#2980)
Browse files Browse the repository at this point in the history
* should can work

* didn't delete configmap for mpdev verify

* done

Co-authored-by: renmingu <40223865+renmingu@users.noreply.github.com>
  • Loading branch information
rmgogogo and renmingu authored Feb 4, 2020
1 parent 122c39d commit 545de31
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 4 deletions.
14 changes: 12 additions & 2 deletions manifests/gcp_marketplace/deployer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ RUN tar -C /usr/local/gcloud -xf /tmp/google-cloud-sdk.tar.gz
RUN /usr/local/gcloud/google-cloud-sdk/install.sh
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin

# move the old entrypoint, because mpdev tool will call it directly, whatever entrypoint is.
# move the old entrypoint
RUN mv /bin/deploy.sh /bin/core_deploy.sh
ADD deployer/init_action.sh /bin/deploy.sh
RUN mv /bin/deploy_with_tests.sh /bin/core_deploy_with_tests.sh

# RUN awk '{sub(/clean_iam_resources.sh/,"clean_action.sh\n\nclean_iam_resources.sh")}1' /bin/core_deploy_with_tests.sh > /bin/new_deploy_with_tests.sh

ADD deployer/init_action.sh /bin/init_action.sh
RUN chmod 755 /bin/init_action.sh

ADD deployer/overlay_deploy.sh /bin/deploy.sh
RUN chmod 755 /bin/deploy.sh

ADD deployer/overlay_deploy_with_tests.sh /bin/deploy_with_tests.sh
RUN chmod 755 /bin/deploy_with_tests.sh

ENTRYPOINT ["/bin/bash", "/bin/deploy.sh"]
9 changes: 7 additions & 2 deletions manifests/gcp_marketplace/deployer/init_action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ function set_bucket_and_configmap() {
# Detect GCP project
GCP_PROJECT_ID=$(curl -H "Metadata-Flavor: Google" -w '\n' "http://metadata.google.internal/computeMetadata/v1/project/project-id")

# Check whether ConfigMap is already exist
if kubectl get configmap ${CONFIG_NAME}; then
echo "Already has a configmap map there"
return 0
fi

for i in $(seq 1 ${NUM_RETRIES})
do
bucket_is_set=true
Expand Down Expand Up @@ -65,5 +71,4 @@ export NAMESPACE

set_bucket_and_configmap "${NAME}-default" 10

# Invoke normal deployer routine.
/bin/bash /bin/core_deploy.sh
echo "init_action done"
27 changes: 27 additions & 0 deletions manifests/gcp_marketplace/deployer/overlay_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Pre-install Init Action
/bin/bash /bin/init_action.sh

# Invoke normal deployer routine.
/bin/bash /bin/core_deploy.sh

# Return core deployment status
code=$?
echo "deployment return code: ${code}"
exit $code
27 changes: 27 additions & 0 deletions manifests/gcp_marketplace/deployer/overlay_deploy_with_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Pre-install Init Action
/bin/bash /bin/init_action.sh

# Invoke normal deployer routine.
/bin/bash /bin/core_deploy_with_tests.sh

# Return core deployment status
code=$?
echo "deployment return code: ${code}"
exit $code

0 comments on commit 545de31

Please sign in to comment.