From 523611c77507a9e74d1eb7e6ba53c5d0b96ce92c Mon Sep 17 00:00:00 2001 From: hayatedayon Date: Sun, 5 Aug 2018 07:54:41 +0900 Subject: [PATCH] perf(.circleci): change cache key. --- .circleci/config.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9ce2213..7ac53b4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,9 +19,7 @@ jobs: - run: sudo chown -R circleci:circleci /usr/local/lib/python2.7/site-packages - restore_cache: keys: - - v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - # fallback to using the latest cache if no exact match is found - - v2-dependencies- + - v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}- - run: name: install cache deb file command: | @@ -31,8 +29,10 @@ jobs: - run: name: install lsb-release and set CLOUD_SDK_REPO command: | - sudo apt-get -d install lsb-release + sudo apt -d install lsb-release if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then + mkdir -p /home/circleci/apt/archives/ + cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/ sudo dpkg -i /var/cache/apt/archives/*.deb fi echo 'export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"' >> $BASH_ENV @@ -41,9 +41,11 @@ jobs: command: | echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - sudo apt-get update - sudo apt-get -d install google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras + sudo apt update + sudo apt -d install google-cloud-sdk google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then + mkdir -p /home/circleci/apt/archives/ + cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/ sudo dpkg -i /var/cache/apt/archives/*.deb fi echo 'export PATH=$PATH:/usr/lib/google-cloud-sdk/platform/google_appengine/bin/' >> $BASH_ENV @@ -51,15 +53,8 @@ jobs: - run: name: vendor our dependencies command: pip install -r requirements.txt - - run: - name: copy deb file to cache directory - command: | - if [[ $(find /var/cache/apt/archives -name "*.deb") == *".deb"* ]];then - mkdir -p /home/circleci/apt/archives/ - cp -r /var/cache/apt/archives/*.deb /home/circleci/apt/archives/ - fi - save_cache: - key: v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} + key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}-{{ epoch }} paths: - "/usr/local/bin" - "/usr/local/lib/python2.7/site-packages" @@ -93,9 +88,7 @@ jobs: - checkout - restore_cache: keys: - - v2-dependencies-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }} - # fallback to using the latest cache if no exact match is found - - v2-dependencies- + - v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum ".circleci/config.yml" }}- - run: name: Retrieve our secrets from the CircleCI environment command: echo $CLIENT_SECRET | base64 --decode > ${HOME}/client-secret.json