Pre-built docker go module dependency cache image (#1318)

This commit is contained in:
Ta-Ching Chen
2019-09-18 05:07:53 +08:00
committed by GitHub
parent c94e02b302
commit 27ec605955
8 changed files with 71 additions and 99 deletions
+32 -21
View File
@@ -65,59 +65,69 @@ setupCIBuildEnv() {
export PRE_UPGRADE_CHECK_IMAGE=$REPO/pre-upgrade-checks
}
load_docker_cache() {
cache=$1
if [ -f ${cache} ]; then
gunzip -c ${cache} | docker load;
fi
build_and_push_go_mod_cache_image() {
image_tag=$1
travis_fold_start go_mod_cache_image $image_tag
gcloud_login
gcloud docker -- pull $image_tag
docker build -q -t $image_tag -f $ROOT/cmd/fission-bundle/Dockerfile.fission-bundle --cache-from ${image_tag} --target godep --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
gcloud docker -- push $image_tag &
travis_fold_end go_mod_cache_image
}
build_and_push_pre_upgrade_check_image() {
image_tag=$1
cache_image=$2
travis_fold_start build_and_push_pre_upgrade_check_image $image_tag
docker build -t $image_tag -f $ROOT/cmd/preupgradechecks/Dockerfile.fission-preupgradechecks --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
docker build -q -t $image_tag -f $ROOT/cmd/preupgradechecks/Dockerfile.fission-preupgradechecks --cache-from ${cache_image} --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
gcloud_login
gcloud docker -- push $image_tag
gcloud docker -- push $image_tag &
travis_fold_end build_and_push_pre_upgrade_check_image
}
build_and_push_fission_bundle() {
image_tag=$1
cache_image=$2
travis_fold_start build_and_push_fission_bundle $image_tag
docker build -q -t $image_tag -f $ROOT/cmd/fission-bundle/Dockerfile.fission-bundle --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
docker build -q -t $image_tag -f $ROOT/cmd/fission-bundle/Dockerfile.fission-bundle --cache-from ${cache_image} --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
gcloud_login
gcloud docker -- push $image_tag
gcloud docker -- push $image_tag &
travis_fold_end build_and_push_fission_bundle
}
build_and_push_fetcher() {
image_tag=$1
cache_image=$2
travis_fold_start build_and_push_fetcher $image_tag
docker build -q -t $image_tag -f $ROOT/cmd/fetcher/Dockerfile.fission-fetcher --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
docker build -q -t $image_tag -f $ROOT/cmd/fetcher/Dockerfile.fission-fetcher --cache-from ${cache_image} --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
gcloud_login
gcloud docker -- push $image_tag
gcloud docker -- push $image_tag &
travis_fold_end build_and_push_fetcher
}
build_and_push_builder() {
image_tag=$1
cache_image=$2
travis_fold_start build_and_push_builder $image_tag
docker build -q -t $image_tag -f $ROOT/cmd/builder/Dockerfile.fission-builder --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
docker build -q -t $image_tag -f $ROOT/cmd/builder/Dockerfile.fission-builder --cache-from ${cache_image} --build-arg GITCOMMIT=$(getGitCommit) --build-arg BUILDDATE=$(getDate) --build-arg BUILDVERSION=$(getVersion) .
gcloud_login
gcloud docker -- push $image_tag
gcloud docker -- push $image_tag &
travis_fold_end build_and_push_builder
}
@@ -139,7 +149,7 @@ build_and_push_env_runtime() {
gcloud_login
gcloud docker -- push $image_tag
gcloud docker -- push $image_tag &
popd
travis_fold_end build_and_push_env_runtime.$env
}
@@ -164,7 +174,7 @@ build_and_push_env_builder() {
gcloud_login
gcloud docker -- push ${image_tag}
gcloud docker -- push ${image_tag} &
popd
travis_fold_end build_and_push_env_builder.$env
}
@@ -598,12 +608,13 @@ install_and_test() {
dump_logs $id
if [ $FAILURES -ne 0 ]
then
# describe each pod in fission ns and function namespace
describe_all_pods $id
exit 1
fi
# Commented out due to Travis-CI log length limit
# if [ $FAILURES -ne 0 ]
# then
# # describe each pod in fission ns and function namespace
# describe_all_pods $id
# exit 1
# fi
}