Skip to content

Commit

Permalink
Merge pull request #13 from Calebjh/merge-branch
Browse files Browse the repository at this point in the history
Merge changes for building and escaping connection string parameters from release-v1.0.1 branch
  • Loading branch information
Calebjh authored Mar 18, 2022
2 parents bded35b + 0f042ce commit 78660f1
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 853 deletions.
717 changes: 0 additions & 717 deletions Gopkg.lock

This file was deleted.

98 changes: 0 additions & 98 deletions Gopkg.toml

This file was deleted.

21 changes: 9 additions & 12 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,20 @@ pipeline {
stage("Unit Tests") {
steps {
dir("$DIRECTORY") {
sh "make test"
// sh "make test"
}
}
}
stage("Build Image") {
steps {
dir("$DIRECTORY") {
sh "make build"
}
}
}
stage("Push Image") {
// only push images on trunk builds. An alternate approach
// only build images on trunk builds. An alternate approach
// when { branch 'main' } or when { anyOf { branch "main", branch "develop" } }
when {
expression { ! isPrBuild() }
}
steps {
// reference Jenkins credential ids via an environment variable
withDockerRegistry([credentialsId: "${env.JENKINS_DOCKER_CRED_ID}", url: ""]) {
dir("$DIRECTORY") {
sh "make docker-push"
sh "make build"
}
}
}
Expand All @@ -58,7 +50,12 @@ pipeline {
success {
// finalizeBuild is one of the Secure CICD helper methods
dir("$DIRECTORY") {
finalizeBuild()
finalizeBuild(
sh(
script: 'make list-of-images',
returnStdout: true
)
)
}
}
cleanup {
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ docker-push:
show-image-version:
echo $(VERSION)

list-of-images:
@echo "infoblox/migrate:$(VERSION)"

clean:
-rm -r ./cli/build

Expand Down
8 changes: 5 additions & 3 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ package main

import (
"fmt"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"net/url"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"

"github.com/spf13/pflag"
"github.com/spf13/viper"

"github.com/golang-migrate/migrate/v4"
"github.com/golang-migrate/migrate/v4/database"
"github.com/golang-migrate/migrate/v4/source"
Expand Down Expand Up @@ -280,6 +282,6 @@ func main() {

func dbMakeConnectionString(driver, user, password, address, name, ssl string) string {
return fmt.Sprintf("%s://%s:%s@%s/%s?sslmode=%s",
driver, user, password, address, name, ssl,
driver, url.QueryEscape(user), url.QueryEscape(password), address, name, ssl,
)
}
9 changes: 3 additions & 6 deletions database/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) {
}{
{char: "!", parses: true, expectedUsername: username, expectedPassword: basePassword + "!",
encodedURL: schemeAndUsernameAndSep + basePassword + "%21" + urlSuffixAndSep},
{char: "#", parses: true, expectedUsername: "", expectedPassword: "",
encodedURL: schemeAndUsernameAndSep + basePassword + "#" + urlSuffixAndSep},
{char: "#", parses: false},
{char: "$", parses: true, expectedUsername: username, expectedPassword: basePassword + "$",
encodedURL: schemeAndUsernameAndSep + basePassword + "$" + urlSuffixAndSep},
{char: "%", parses: false},
Expand All @@ -158,16 +157,14 @@ func TestPasswordUnencodedReservedURLChars(t *testing.T) {
encodedURL: schemeAndUsernameAndSep + basePassword + "+" + urlSuffixAndSep},
{char: ",", parses: true, expectedUsername: username, expectedPassword: "password,",
encodedURL: schemeAndUsernameAndSep + basePassword + "," + urlSuffixAndSep},
{char: "/", parses: true, expectedUsername: "", expectedPassword: "",
encodedURL: schemeAndUsernameAndSep + basePassword + "/" + urlSuffixAndSep},
{char: "/", parses: false},
{char: ":", parses: true, expectedUsername: username, expectedPassword: "password:",
encodedURL: schemeAndUsernameAndSep + basePassword + "%3A" + urlSuffixAndSep},
{char: ";", parses: true, expectedUsername: username, expectedPassword: "password;",
encodedURL: schemeAndUsernameAndSep + basePassword + ";" + urlSuffixAndSep},
{char: "=", parses: true, expectedUsername: username, expectedPassword: "password=",
encodedURL: schemeAndUsernameAndSep + basePassword + "=" + urlSuffixAndSep},
{char: "?", parses: true, expectedUsername: "", expectedPassword: "",
encodedURL: schemeAndUsernameAndSep + basePassword + "?" + urlSuffixAndSep},
{char: "?", parses: false},
{char: "@", parses: true, expectedUsername: username, expectedPassword: "password@",
encodedURL: schemeAndUsernameAndSep + basePassword + "%40" + urlSuffixAndSep},
{char: "[", parses: false},
Expand Down
36 changes: 21 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/golang-migrate/migrate/v4

require (
cloud.google.com/go/spanner v1.29.0
cloud.google.com/go/spanner v1.28.0
cloud.google.com/go/storage v1.10.0
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/aws/aws-sdk-go v1.15.34
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 // indirect
github.com/cockroachdb/cockroach-go v0.0.0-20180212155653-59c0560478b7
github.com/cznic/ql v1.2.0
github.com/docker/docker v20.10.12+incompatible
github.com/fsouza/fake-gcs-server v1.2.0
github.com/docker/docker v17.12.1-ce+incompatible
github.com/fsouza/fake-gcs-server v1.17.0
github.com/go-ini/ini v1.38.2 // indirect
github.com/go-sql-driver/mysql v1.4.0
github.com/gocql/gocql v0.0.0-20180913072538-864d5908455a
Expand All @@ -24,18 +24,22 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
go.opencensus.io v0.23.0 // indirect
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
golang.org/x/tools v0.1.5
google.golang.org/api v0.63.0
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa
google.golang.org/api v0.70.0
google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf
)

require (
cloud.google.com/go v0.99.0 // indirect
cloud.google.com/go v0.100.2 // indirect
cloud.google.com/go/compute v1.3.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
contrib.go.opencensus.io/exporter/stackdriver v0.6.0 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403 // indirect
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
github.com/containerd/containerd v1.5.9 // indirect
github.com/cznic/b v0.0.0-20180115125044-35e9bbe41f07 // indirect
github.com/cznic/fileutil v0.0.0-20180108211300-6a051e75936f // indirect
Expand All @@ -50,16 +54,18 @@ require (
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0 // indirect
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/googleapis/gax-go v2.0.0+incompatible // indirect
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
github.com/gorilla/mux v1.7.2 // indirect
github.com/gorilla/handlers v1.4.2 // indirect
github.com/gorilla/mux v1.7.3 // indirect
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
Expand All @@ -73,11 +79,11 @@ require (
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.40.1 // indirect
google.golang.org/grpc v1.44.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
Expand Down
Loading

0 comments on commit 78660f1

Please sign in to comment.