Skip to content

Commit

Permalink
Merge pull request #6784 from cevich/new_ci_cd
Browse files Browse the repository at this point in the history
Cirrus: Make efficient and performant
  • Loading branch information
baude authored Oct 5, 2020
2 parents 436dda2 + 2c9084e commit caace52
Show file tree
Hide file tree
Showing 26 changed files with 1,179 additions and 1,787 deletions.
1,098 changes: 565 additions & 533 deletions .cirrus.yml

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,32 @@ run:
- pkg/varlink
- pkg/varlinkapi
- docs/varlink
- vendor
skip-files:
- iopodman.go
- swagger.go
modules-download-mode: readonly
linters:
enable-all: true
disable:
# All these break for one reason or another
- dupl
- funlen
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- gosec
- golint
- lll
- structcheck
- typecheck
- unconvert
- varcheck
- deadcode
- depguard
- errcheck
- gocritic
- gosec
- maligned
linters-settings:
errcheck:
Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ golangci-lint: .gopathok varlink_generate .install.golangci-lint

.PHONY: gofmt
gofmt: ## Verify the source code gofmt
find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+
find . -name '*.go' -type f \
-not \( \
-name '.golangci.yml' -o \
-name 'Makefile' -o \
-path './vendor/*' -prune -o \
-path './contrib/*' -prune \
\) -exec gofmt -d -e -s -w {} \+
git diff --exit-code

.PHONY: test/checkseccomp/checkseccomp
Expand Down
150 changes: 0 additions & 150 deletions contrib/cirrus/README.md

This file was deleted.

28 changes: 15 additions & 13 deletions contrib/cirrus/add_second_partition.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# N/B: This script could mega f*!@up your disks if run by mistake.
# it is left without the execute-bit on purpose!

set -eo pipefail

# shellcheck source=./lib.sh
source $(dirname $0)/lib.sh

# $SLASH_DEVICE is the disk device to be f*xtuP
SLASH_DEVICE="/dev/sda" # Always the case on GCP

Expand All @@ -11,21 +16,18 @@ SLASH_DEVICE="/dev/sda" # Always the case on GCP
NEW_PART_START="50%"
NEW_PART_END="100%"

set -eo pipefail

source $(dirname $0)/lib.sh

if [[ ! -r "/root" ]] || [[ -r "/root/second_partition_ready" ]]
then
echo "Warning: Ignoring attempted execution of $(basename $0)"
warn "Ignoring attempted execution of $(basename $0)"
exit 0
fi

[[ -n "type -P parted" ]] || \
die 2 "The parted command is required."
[[ -x "$(type -P parted)" ]] || \
die "The parted command is required."

[[ ! -b ${SLASH_DEVICE}2 ]] || \
die 5 "Found unexpected block device ${SLASH_DEVICE}2"
die "Found unexpected block device ${SLASH_DEVICE}2"

PPRINTCMD="parted --script ${SLASH_DEVICE} print"
FINDMNTCMD="findmnt --source=${SLASH_DEVICE}1 --mountpoint=/ --canonicalize --evaluate --first-only --noheadings"
Expand All @@ -34,28 +36,28 @@ trap "rm -f $TMPF" EXIT

if $FINDMNTCMD | tee $TMPF | egrep -q "^/\s+${SLASH_DEVICE}1"
then
echo "Repartitioning original partition table:"
msg "Repartitioning original partition table:"
$PPRINTCMD
else
die 6 "Unexpected output from '$FINDMNTCMD': $(<$TMPF)"
die "Unexpected output from '$FINDMNTCMD': $(<$TMPF)"
fi

echo "Adding partition offset within unpartitioned space."
parted --script --align optimal /dev/sda unit % mkpart primary "" "" "$NEW_PART_START" "$NEW_PART_END"

echo "New partition table:"
msg "New partition table:"
$PPRINTCMD

echo "Growing ${SLASH_DEVICE}1 meet start of ${SLASH_DEVICE}2"
msg "Growing ${SLASH_DEVICE}1 meet start of ${SLASH_DEVICE}2"
growpart ${SLASH_DEVICE} 1

FSTYPE=$(findmnt --first-only --noheadings --output FSTYPE ${SLASH_DEVICE}1)
echo "Expanding $FSTYPE filesystem on ${SLASH_DEVICE}1"
case $FSTYPE in
ext*) resize2fs ${SLASH_DEVICE}1 ;;
*) die 11 "Script $(basename $0) doesn't know how to resize a $FSTYPE filesystem." ;;
*) die "Script $(basename $0) doesn't know how to resize a $FSTYPE filesystem." ;;
esac

# Must happen last - signals completion to other tooling
echo "Recording newly available disk partition device into /root/second_partition_ready"
msg "Recording newly available disk partition device into /root/second_partition_ready"
echo "${SLASH_DEVICE}2" > /root/second_partition_ready
65 changes: 0 additions & 65 deletions contrib/cirrus/apiv2_test.sh

This file was deleted.

34 changes: 0 additions & 34 deletions contrib/cirrus/build_release.sh

This file was deleted.

17 changes: 0 additions & 17 deletions contrib/cirrus/build_swagger.sh

This file was deleted.

Loading

0 comments on commit caace52

Please sign in to comment.