Backport GitHub Actions Docker image building to 1.4 series (#2706)

* setup ci in github actions

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* remove travis config

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* Add changelog for v1.4.2

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* update build status badge on readme

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* don't error during backup when additional items returned by plugin don't exist (#2595)

* log a warning instead of erroring if additional item can't be found

Signed-off-by: Steve Kriss <krisss@vmware.com>

* always show backup warning/error count in get/describe

Signed-off-by: Steve Kriss <krisss@vmware.com>

* changelog

Signed-off-by: Steve Kriss <krisss@vmware.com>

* Update changelogs

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
Co-authored-by: Steve Kriss <krisss@vmware.com>
release-1.4 v1.4.2
Nolan Brubaker 2020-07-13 15:35:26 -04:00 committed by GitHub
parent 6e0469e7f3
commit 56a08a4d69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 99 additions and 70 deletions

View File

@ -1,5 +1,5 @@
name: Pull Request CI Check
on: [push, pull_request]
on: [pull_request]
jobs:
build:

34
.github/workflows/push.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Master CI
on:
push:
branches: [ master ]
tags:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v2
with:
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build
run: make local
- name: Test
run: make test
- name: Publish container image
run: |
docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_PASSWORD }}
./hack/docker-push.sh

View File

@ -1,24 +0,0 @@
dist: xenial
language: go
go:
- 1.14.x
sudo: required
services:
- docker
script:
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH;
else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, PR=$TRAVIS_PULL_REQUEST, BRANCH=$BRANCH"
- hack/ci-check.sh
deploy:
- provider: script
skip_cleanup: true
script: hack/docker-push.sh
on:
repo: vmware-tanzu/velero
all_branches: true
env:
global:
# generated using `travis encrypt`: https://docs.travis-ci.com/user/environment-variables#encrypting-environment-variables
- secure: Sa0R7bhOvrybIWvURjEpOLQ3/v1IqiSM2uwYTSMhLtwHunkiYXpbXi/wVPkujM7kgnFeJzGfNTZI6blkl3Vnz6Ca48avxiv+KRk7bNlTn/e2LkJaqOh/NcwqrVyWG8cZpWTHAzwJkHrV6xcWRTWFqx/UhUHH4PdmXd0pj3/DDxHhUZXJkZfYDC2uI+kmhJd9x1yxxz6OTXrGeMw22R5RtgltcQYjYWjGhXjNJ96+0QhC6juCwwtuU3oz7vfV1dP6ea9yeiHKCdDR0xp/Ymtlt4DULgQv4vuVBCR7LuPjsdLI1QslKbCz+vk/XwEcckf3R+yJUaArGLSM0f3AwuAZnETwkfKu9gJCEz8Xvvwsy5QHj/DGeSr+JY4Ylb1YzJG48R5QMcNwOgQOpewamBggxkyyOlNanUGzMJ8F7zjDOZjOUsRSSG+cn01/oJEHNyFmNkxbugOGuxqpi8qIfyWrdPSb8AdnUVUi2GDR/unSm2uZLSJtjaeypqzxalFdL04pbkk6/vKZTi6VMIyewHeR0XIC/VKQ+av2CwjnfqTtTHQHMh2kVxVzy4SKPYgWvbUUg9SG0z2lmfBWzE1HS+ozUKruxBu/YnPHaFz3D/+w0AwtHSYp3FMkCC/2SZU1hiOzAKX+S8T5K1OKoBiIEEUVa90EnSslCIiNIUHXgdtG62U=
- secure: MAHgHvxxPJKxcECwdjaTa/ZW2wlhfcpcprXZqPJKQVFS6S5Wc+xf0CBRggnZT/aEs52EpD2bZy505a4uy9EcTDeq7q5oaXbOBFdyKgB1leWiycup60p6BmVqre5//EzXe+CJpkSu46ajcVORJIEGjs0tS5p0HV70sqpsfd13L2pXpmZ54RIj+TOm7Tz6VVeSNUmQ7WymIrvKg4cQ50w+aS7ak+gy8b6oYKWX01oZPQZA3W1pvYcBgBKobiQN8dh7WvT6QmTu/38WykTjt+9CfEJOboitgEESMjf06ueaLrhQoKQafH3XzfkfEW7PWWGl1RZYMEf15Joj1edIW1i9eYZ1T3fvBaIwvgc7lLgNdzc5ZxG8eEtoDSfB0+gDJOPBLCo+5G3xvRCie7OkKvXdijkCKmc+FRMJlayHkEw75cgId9svDEJghtt2VlWAM4ba4S79Og+cyI0VROkzS0FEjabz74tU9haVaypVnLmzEC/BhilzCt/jhRuYInpsMBeasGQ6Rg8gjos4AQamdaXJRI520o7zFWXVYqctfPr+mrVOYCfUISnSS3uqb4UlvLBqXDPVWBBIgmPrSgvHXxbjsajFuyWTULm60nj/JUuh7BC9HF9pil3g4/2E9cpLZCFQxVYu6+30eEv4dCO7Ptq3XIINDWbbS6Pmw62/ZsE8ABU=

View File

@ -33,8 +33,8 @@ If you are ready to jump in and test, add code, or help with documentation, foll
See [the list of releases][6] to find out about feature changes.
[1]: https://travis-ci.org/vmware-tanzu/velero.svg?branch=master
[2]: https://travis-ci.org/vmware-tanzu/velero
[1]: https://github.com/vmware-tanzu/velero/workflows/Master%20CI/badge.svg
[2]: https://github.com/vmware-tanzu/velero/actions?query=workflow%3A"Master+CI"
[4]: https://github.com/vmware-tanzu/velero/issues
[6]: https://github.com/vmware-tanzu/velero/releases
[9]: https://kubernetes.io/docs/setup/

View File

@ -1,11 +1,11 @@
## v1.4.1
## v1.4.2
### 2020-07-13
### Download
https://github.com/vmware-tanzu/velero/releases/tag/v1.4.1
https://github.com/vmware-tanzu/velero/releases/tag/v1.4.2
### Container Image
`velero/velero:v1.4.1`
`velero/velero:v1.4.2`
### Documentation
https://velero.io/docs/v1.4/
@ -14,9 +14,15 @@ https://velero.io/docs/v1.4/
https://velero.io/docs/v1.4/upgrade-to-1.4/
### All Changes
* log a warning instead of erroring if an additional item returned from a plugin can't be found in the Kubernetes API (#2595, @skriss)
* Adjust restic default time out to 4 hours and base pod resource requests to 500m CPU/512Mi memory. (#2696, @nrb)
* capture version of the CRD prior before invoking the remap_crd_version backup item action (#2683, @ashish-amarnath)
## v1.4.1
This tag was created in code, but has no associated docker image due to misconfigured building infrastructure. v1.4.2 fixes this.
## v1.4.0
### 2020-05-26

View File

@ -1 +0,0 @@
capture version of the CRD prior before invoking the remap_crd_version backup item action

View File

@ -1 +0,0 @@
Adjust restic default time out to 4 hours and base pod resource requests to 500m CPU/512Mi memory.

View File

@ -20,8 +20,8 @@
set +x
if [[ -z "$TRAVIS" ]]; then
echo "This script is intended to be run only on Travis." >&2
if [[ -z "$CI" ]]; then
echo "This script is intended to be run only on Github Actions." >&2
exit 1
fi
@ -47,37 +47,43 @@ function highest_release() {
done
}
triggeredBy=$(echo $GITHUB_REF | cut -d / -f 2)
if [[ "$triggeredBy" == "heads" ]]; then
BRANCH=$(echo $GITHUB_REF | cut -d / -f 3)
TAG=
elif [[ "$triggeredBy" == "tags" ]]; then
BRANCH=
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
fi
if [[ "$BRANCH" == "master" ]]; then
VERSION="$BRANCH"
elif [[ ! -z "$TRAVIS_TAG" ]]; then
# Tags aren't fetched by Travis on checkout, and we don't need them for master
elif [[ ! -z "$TAG" ]]; then
# Explicitly checkout tags when building from a git tag.
# This is not needed when building from master
git fetch --tags
# Calculate the latest release if there's a tag.
highest_release
VERSION="$TRAVIS_TAG"
VERSION="$TAG"
else
# If we're not on master and we're not building a tag, exit early.
echo "We're not on master and we're not building a tag, exit early."
exit 0
fi
# Assume we're not tagging `latest` by default, and never on master.
TAG_LATEST=false
if [[ "$BRANCH" == "master" ]]; then
echo "Building master, not tagging latest."
elif [[ "$TRAVIS_TAG" == "$HIGHEST" ]]; then
elif [[ "$TAG" == "$HIGHEST" ]]; then
TAG_LATEST=true
fi
# Debugging info
echo "Highest tag found: $HIGHEST"
echo "BRANCH: $BRANCH"
echo "TRAVIS_TAG: $TRAVIS_TAG"
echo "TAG: $TAG"
echo "TAG_LATEST: $TAG_LATEST"
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
unset GIT_HTTP_USER_AGENT
echo "Building and pushing container images."
VERSION="$VERSION" TAG_LATEST="$TAG_LATEST" make all-containers all-push all-manifests

View File

@ -1723,7 +1723,7 @@ func TestBackupActionAdditionalItems(t *testing.T) {
},
{
name: "if there's an error backing up additional items, the item the action was run for isn't backed up",
name: "if additional items aren't found in the API, they're skipped and the original item is still backed up",
backup: defaultBackup().Result(),
apiResources: []*test.APIResource{
test.Pods(
@ -1746,8 +1746,10 @@ func TestBackupActionAdditionalItems(t *testing.T) {
},
},
want: []string{
"resources/pods/namespaces/ns-1/pod-1.json",
"resources/pods/namespaces/ns-2/pod-2.json",
"resources/pods/namespaces/ns-3/pod-3.json",
"resources/pods/v1-preferredversion/namespaces/ns-1/pod-1.json",
"resources/pods/v1-preferredversion/namespaces/ns-2/pod-2.json",
"resources/pods/v1-preferredversion/namespaces/ns-3/pod-3.json",
},

View File

@ -26,6 +26,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
corev1api "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@ -341,12 +342,20 @@ func (ib *itemBackupper) executeActions(
return nil, err
}
additionalItem, err := client.Get(additionalItem.Name, metav1.GetOptions{})
item, err := client.Get(additionalItem.Name, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
log.WithFields(logrus.Fields{
"groupResource": additionalItem.GroupResource,
"namespace": additionalItem.Namespace,
"name": additionalItem.Name,
}).Warnf("Additional item was not found in Kubernetes API, can't back it up")
continue
}
if err != nil {
return nil, errors.WithStack(err)
}
if _, err = ib.backupItem(log, additionalItem, gvr.GroupResource(), gvr); err != nil {
if _, err = ib.backupItem(log, item, gvr.GroupResource(), gvr); err != nil {
return nil, err
}
}

View File

@ -70,11 +70,9 @@ func DescribeBackup(
}
}
if status.Phase == velerov1api.BackupPhasePartiallyFailed {
d.Println()
d.Printf("Errors:\t%d\n", status.Errors)
d.Printf("Warnings:\t%d\n", status.Warnings)
}
d.Println()
d.Printf("Errors:\t%d\n", status.Errors)
d.Printf("Warnings:\t%d\n", status.Warnings)
d.Println()
DescribeBackupSpec(d, backup.Spec)

View File

@ -35,6 +35,8 @@ var (
// https://github.com/kubernetes/kubernetes/blob/v1.15.3/pkg/printers/tableprinter.go#L204
{Name: "Name", Type: "string", Format: "name"},
{Name: "Status"},
{Name: "Errors"},
{Name: "Warnings"},
{Name: "Created"},
{Name: "Expires"},
{Name: "Storage Location"},
@ -58,7 +60,6 @@ func printBackupList(list *velerov1api.BackupList) []metav1.TableRow {
var timestampSuffix = regexp.MustCompile("-[0-9]{14}$")
func sortBackupsByPrefixAndTimestamp(list *velerov1api.BackupList) {
sort.Slice(list.Items, func(i, j int) bool {
iSuffixIndex := timestampSuffix.FindStringIndex(list.Items[i].Name)
jSuffixIndex := timestampSuffix.FindStringIndex(list.Items[j].Name)
@ -98,18 +99,17 @@ func printBackup(backup *velerov1api.Backup) []metav1.TableRow {
if backup.DeletionTimestamp != nil && !backup.DeletionTimestamp.Time.IsZero() {
status = "Deleting"
}
if status == string(velerov1api.BackupPhasePartiallyFailed) {
if backup.Status.Errors == 1 {
status = fmt.Sprintf("%s (1 error)", status)
} else {
status = fmt.Sprintf("%s (%d errors)", status, backup.Status.Errors)
}
}
location := backup.Spec.StorageLocation
row.Cells = append(row.Cells, backup.Name, status, backup.Status.StartTimestamp, humanReadableTimeFromNow(expiration), location, metav1.FormatLabelSelector(backup.Spec.LabelSelector))
row.Cells = append(row.Cells,
backup.Name,
status,
backup.Status.Errors,
backup.Status.Warnings,
backup.Status.StartTimestamp,
humanReadableTimeFromNow(expiration),
backup.Spec.StorageLocation,
metav1.FormatLabelSelector(backup.Spec.LabelSelector),
)
return []metav1.TableRow{row}
}

View File

@ -30,8 +30,8 @@ var (
{Name: "Name", Type: "string", Format: "name"},
{Name: "Backup"},
{Name: "Status"},
{Name: "Warnings"},
{Name: "Errors"},
{Name: "Warnings"},
{Name: "Created"},
{Name: "Selector"},
}
@ -60,8 +60,8 @@ func printRestore(restore *v1.Restore) []metav1.TableRow {
restore.Name,
restore.Spec.BackupName,
status,
restore.Status.Warnings,
restore.Status.Errors,
restore.Status.Warnings,
restore.CreationTimestamp.Time,
metav1.FormatLabelSelector(restore.Spec.LabelSelector),
)

View File

@ -33,8 +33,8 @@ If you are ready to jump in and test, add code, or help with documentation, foll
See [the list of releases][6] to find out about feature changes.
[1]: https://travis-ci.org/vmware-tanzu/velero.svg?branch=master
[2]: https://travis-ci.org/vmware-tanzu/velero
[1]: https://github.com/vmware-tanzu/velero/workflows/Master%20CI/badge.svg
[2]: https://github.com/vmware-tanzu/velero/actions?query=workflow%3A"Master+CI"
[4]: https://github.com/vmware-tanzu/velero/issues
[6]: https://github.com/vmware-tanzu/velero/releases

View File

@ -33,8 +33,8 @@ If you are ready to jump in and test, add code, or help with documentation, foll
See [the list of releases][6] to find out about feature changes.
[1]: https://travis-ci.org/vmware-tanzu/velero.svg?branch=master
[2]: https://travis-ci.org/vmware-tanzu/velero
[1]: https://github.com/vmware-tanzu/velero/workflows/Master%20CI/badge.svg
[2]: https://github.com/vmware-tanzu/velero/actions?query=workflow%3A"Master+CI"
[4]: https://github.com/vmware-tanzu/velero/issues
[6]: https://github.com/vmware-tanzu/velero/releases