mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:32:13 +02:00
Retry Snap upload in pipeline (#8300)
* add set -e to all bash instances in deploy-stage.yml * retry uploading snap if we fail * Add the rest of the set -e calls for bash in azure while we're here * use retry based on travis_retry * add set -e to the script: sections that run on macOS/Linux * actually don't fail on result * reset result before running command because bash short circuits or conditionals * remove inapplicable comment
This commit is contained in:
@@ -13,17 +13,18 @@ jobs:
|
|||||||
arm64v8:
|
arm64v8:
|
||||||
DOCKER_ARCH: arm64v8
|
DOCKER_ARCH: arm64v8
|
||||||
steps:
|
steps:
|
||||||
- bash: tools/docker/build.sh $(dockerTag) $DOCKER_ARCH
|
- bash: set -e && tools/docker/build.sh $(dockerTag) $DOCKER_ARCH
|
||||||
displayName: Build the Docker images
|
displayName: Build the Docker images
|
||||||
# We don't filter for the Docker Hub organization to continue to allow
|
# We don't filter for the Docker Hub organization to continue to allow
|
||||||
# easy testing of these scripts on forks.
|
# easy testing of these scripts on forks.
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
DOCKER_IMAGES=$(docker images --filter reference='*/certbot' --filter reference='*/dns-*' --format '{{.Repository}}')
|
DOCKER_IMAGES=$(docker images --filter reference='*/certbot' --filter reference='*/dns-*' --format '{{.Repository}}')
|
||||||
docker save --output images.tar $DOCKER_IMAGES
|
docker save --output images.tar $DOCKER_IMAGES
|
||||||
displayName: Save the Docker images
|
displayName: Save the Docker images
|
||||||
# If the name of the tar file or artifact changes, the deploy stage will
|
# If the name of the tar file or artifact changes, the deploy stage will
|
||||||
# also need to be updated.
|
# also need to be updated.
|
||||||
- bash: mv images.tar $(Build.ArtifactStagingDirectory)
|
- bash: set -e && mv images.tar $(Build.ArtifactStagingDirectory)
|
||||||
displayName: Prepare Docker artifact
|
displayName: Prepare Docker artifact
|
||||||
- task: PublishPipelineArtifact@1
|
- task: PublishPipelineArtifact@1
|
||||||
inputs:
|
inputs:
|
||||||
@@ -109,6 +110,7 @@ jobs:
|
|||||||
ARCHS: amd64
|
ARCHS: amd64
|
||||||
steps:
|
steps:
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends snapd
|
sudo apt-get install -y --no-install-recommends snapd
|
||||||
sudo snap install --classic snapcraft
|
sudo snap install --classic snapcraft
|
||||||
@@ -122,6 +124,7 @@ jobs:
|
|||||||
inputs:
|
inputs:
|
||||||
secureFile: launchpad-credentials
|
secureFile: launchpad-credentials
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
git config --global user.email "$(Build.RequestedForEmail)"
|
git config --global user.email "$(Build.RequestedForEmail)"
|
||||||
git config --global user.name "$(Build.RequestedFor)"
|
git config --global user.name "$(Build.RequestedFor)"
|
||||||
mkdir -p ~/.local/share/snapcraft/provider/launchpad
|
mkdir -p ~/.local/share/snapcraft/provider/launchpad
|
||||||
@@ -129,6 +132,7 @@ jobs:
|
|||||||
python3 tools/snap/build_remote.py ALL --archs ${ARCHS}
|
python3 tools/snap/build_remote.py ALL --archs ${ARCHS}
|
||||||
displayName: Build snaps
|
displayName: Build snaps
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
mv *.snap $(Build.ArtifactStagingDirectory)
|
mv *.snap $(Build.ArtifactStagingDirectory)
|
||||||
mv certbot-dns-*/*.snap $(Build.ArtifactStagingDirectory)
|
mv certbot-dns-*/*.snap $(Build.ArtifactStagingDirectory)
|
||||||
displayName: Prepare artifacts
|
displayName: Prepare artifacts
|
||||||
@@ -147,6 +151,7 @@ jobs:
|
|||||||
versionSpec: 3.8
|
versionSpec: 3.8
|
||||||
addToPath: true
|
addToPath: true
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends nginx-light snapd
|
sudo apt-get install -y --no-install-recommends nginx-light snapd
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
@@ -159,9 +164,11 @@ jobs:
|
|||||||
path: $(Build.SourcesDirectory)/snap
|
path: $(Build.SourcesDirectory)/snap
|
||||||
displayName: Retrieve Certbot snaps
|
displayName: Retrieve Certbot snaps
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
sudo snap install --dangerous --classic snap/certbot_*_amd64.snap
|
sudo snap install --dangerous --classic snap/certbot_*_amd64.snap
|
||||||
displayName: Install Certbot snap
|
displayName: Install Certbot snap
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
venv/bin/python -m tox -e integration-external,apacheconftest-external-with-pebble
|
venv/bin/python -m tox -e integration-external,apacheconftest-external-with-pebble
|
||||||
displayName: Run tox
|
displayName: Run tox
|
||||||
- job: snap_dns_run
|
- job: snap_dns_run
|
||||||
@@ -170,6 +177,7 @@ jobs:
|
|||||||
vmImage: ubuntu-18.04
|
vmImage: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends snapd
|
sudo apt-get install -y --no-install-recommends snapd
|
||||||
displayName: Install dependencies
|
displayName: Install dependencies
|
||||||
@@ -183,10 +191,12 @@ jobs:
|
|||||||
path: $(Build.SourcesDirectory)/snap
|
path: $(Build.SourcesDirectory)/snap
|
||||||
displayName: Retrieve Certbot snaps
|
displayName: Retrieve Certbot snaps
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
python3 -m venv venv
|
python3 -m venv venv
|
||||||
venv/bin/python letsencrypt-auto-source/pieces/pipstrap.py
|
venv/bin/python letsencrypt-auto-source/pieces/pipstrap.py
|
||||||
venv/bin/python tools/pip_install.py -e certbot-ci
|
venv/bin/python tools/pip_install.py -e certbot-ci
|
||||||
displayName: Prepare Certbot-CI
|
displayName: Prepare Certbot-CI
|
||||||
- script: |
|
- script: |
|
||||||
|
set -e
|
||||||
sudo -E venv/bin/pytest certbot-ci/snap_integration_tests/dns_tests --allow-persistent-changes --snap-folder $(Build.SourcesDirectory)/snap --snap-arch amd64
|
sudo -E venv/bin/pytest certbot-ci/snap_integration_tests/dns_tests --allow-persistent-changes --snap-folder $(Build.SourcesDirectory)/snap --snap-arch amd64
|
||||||
displayName: Test DNS plugins snaps
|
displayName: Test DNS plugins snaps
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ stages:
|
|||||||
steps:
|
steps:
|
||||||
# If we change the output filename from `release_notes.md`, it should also be changed in tools/create_github_release.py
|
# If we change the output filename from `release_notes.md`, it should also be changed in tools/create_github_release.py
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
CERTBOT_VERSION="$(cd certbot && python -c "import certbot; print(certbot.__version__)" && cd ~-)"
|
CERTBOT_VERSION="$(cd certbot && python -c "import certbot; print(certbot.__version__)" && cd ~-)"
|
||||||
"${BUILD_REPOSITORY_LOCALPATH}\tools\extract_changelog.py" "${CERTBOT_VERSION}" >> "${BUILD_ARTIFACTSTAGINGDIRECTORY}/release_notes.md"
|
"${BUILD_REPOSITORY_LOCALPATH}\tools\extract_changelog.py" "${CERTBOT_VERSION}" >> "${BUILD_ARTIFACTSTAGINGDIRECTORY}/release_notes.md"
|
||||||
displayName: Prepare changelog
|
displayName: Prepare changelog
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ stages:
|
|||||||
- group: certbot-common
|
- group: certbot-common
|
||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends snapd
|
sudo apt-get install -y --no-install-recommends snapd
|
||||||
sudo snap install --classic snapcraft
|
sudo snap install --classic snapcraft
|
||||||
@@ -53,10 +54,25 @@ stages:
|
|||||||
inputs:
|
inputs:
|
||||||
secureFile: snapcraft.cfg
|
secureFile: snapcraft.cfg
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
|
retry_command() {
|
||||||
|
# based on travis_retry.bash https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash
|
||||||
|
local result=0
|
||||||
|
local count=1
|
||||||
|
while [[ "${count}" -le 3 ]]; do
|
||||||
|
result=0
|
||||||
|
"${@}" || result="${?}"
|
||||||
|
if [[ $result -eq 0 ]]; then break; fi
|
||||||
|
count="$((count + 1))"
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
return "${result}"
|
||||||
|
}
|
||||||
mkdir -p .snapcraft
|
mkdir -p .snapcraft
|
||||||
ln -s $(snapcraftCfg.secureFilePath) .snapcraft/snapcraft.cfg
|
ln -s $(snapcraftCfg.secureFilePath) .snapcraft/snapcraft.cfg
|
||||||
for SNAP_FILE in snap/*.snap; do
|
for SNAP_FILE in snap/*.snap; do
|
||||||
snapcraft upload --release=${{ parameters.snapReleaseChannel }} "${SNAP_FILE}"
|
retry_command eval snapcraft upload --release=${{ parameters.snapReleaseChannel }} "${SNAP_FILE}"
|
||||||
done
|
done
|
||||||
displayName: Publish to Snap store
|
displayName: Publish to Snap store
|
||||||
- job: publish_docker
|
- job: publish_docker
|
||||||
@@ -76,7 +92,7 @@ stages:
|
|||||||
artifact: docker_$(DOCKER_ARCH)
|
artifact: docker_$(DOCKER_ARCH)
|
||||||
path: $(Build.SourcesDirectory)
|
path: $(Build.SourcesDirectory)
|
||||||
displayName: Retrieve Docker images
|
displayName: Retrieve Docker images
|
||||||
- bash: docker load --input $(Build.SourcesDirectory)/images.tar
|
- bash: set -e && docker load --input $(Build.SourcesDirectory)/images.tar
|
||||||
displayName: Load Docker images
|
displayName: Load Docker images
|
||||||
- task: Docker@2
|
- task: Docker@2
|
||||||
inputs:
|
inputs:
|
||||||
@@ -93,5 +109,5 @@ stages:
|
|||||||
# Certbot organization on Docker Hub.
|
# Certbot organization on Docker Hub.
|
||||||
containerRegistry: docker-hub
|
containerRegistry: docker-hub
|
||||||
displayName: Login to Docker Hub
|
displayName: Login to Docker Hub
|
||||||
- bash: tools/docker/deploy.sh $(dockerTag) $DOCKER_ARCH
|
- bash: set -e && tools/docker/deploy.sh $(dockerTag) $DOCKER_ARCH
|
||||||
displayName: Deploy the Docker images
|
displayName: Deploy the Docker images
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ stages:
|
|||||||
vmImage: ubuntu-latest
|
vmImage: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
MESSAGE="\
|
MESSAGE="\
|
||||||
---\n\
|
---\n\
|
||||||
##### Azure Pipeline
|
##### Azure Pipeline
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
brew install augeas
|
brew install augeas
|
||||||
condition: startswith(variables['IMAGE_NAME'], 'macOS')
|
condition: startswith(variables['IMAGE_NAME'], 'macOS')
|
||||||
displayName: Install MacOS dependencies
|
displayName: Install MacOS dependencies
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y --no-install-recommends \
|
sudo apt-get install -y --no-install-recommends \
|
||||||
python-dev \
|
python-dev \
|
||||||
@@ -29,6 +31,7 @@ steps:
|
|||||||
# set, pip updates dependencies it thinks are already satisfied to avoid some
|
# set, pip updates dependencies it thinks are already satisfied to avoid some
|
||||||
# problems with its lack of real dependency resolution.
|
# problems with its lack of real dependency resolution.
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
python letsencrypt-auto-source/pieces/pipstrap.py
|
python letsencrypt-auto-source/pieces/pipstrap.py
|
||||||
python tools/pip_install.py -I tox virtualenv
|
python tools/pip_install.py -I tox virtualenv
|
||||||
displayName: Install runtime dependencies
|
displayName: Install runtime dependencies
|
||||||
@@ -38,6 +41,7 @@ steps:
|
|||||||
secureFile: azure-test-farm.pem
|
secureFile: azure-test-farm.pem
|
||||||
condition: contains(variables['TOXENV'], 'test-farm')
|
condition: contains(variables['TOXENV'], 'test-farm')
|
||||||
- bash: |
|
- bash: |
|
||||||
|
set -e
|
||||||
export TARGET_BRANCH="`echo "${BUILD_SOURCEBRANCH}" | sed -E 's!refs/(heads|tags)/!!g'`"
|
export TARGET_BRANCH="`echo "${BUILD_SOURCEBRANCH}" | sed -E 's!refs/(heads|tags)/!!g'`"
|
||||||
[ -z "${SYSTEM_PULLREQUEST_TARGETBRANCH}" ] || export TARGET_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
[ -z "${SYSTEM_PULLREQUEST_TARGETBRANCH}" ] || export TARGET_BRANCH="${SYSTEM_PULLREQUEST_TARGETBRANCH}"
|
||||||
env
|
env
|
||||||
|
|||||||
Reference in New Issue
Block a user