Skip to content

Commit

Permalink
[ci skip] 2019.01.22-1464
Browse files Browse the repository at this point in the history
  • Loading branch information
cybozu-neco committed Jan 22, 2019
2 parents 6e7a02b + e4dbf9f commit 0c025be
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 7 deletions.
8 changes: 6 additions & 2 deletions dctest/auto-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

set -e

http_proxy=http://10.0.49.3:3128/
https_proxy=http://10.0.49.3:3128/

cat > /etc/apt/sources.list <<EOF
deb http://mirror.math.princeton.edu/pub/ubuntu bionic main restricted universe multiverse
deb http://mirror.math.princeton.edu/pub/ubuntu bionic-updates main restricted universe multiverse
deb http://mirror.math.princeton.edu/pub/ubuntu bionic-security main restricted universe multiverse
EOF

apt-get update
apt-get install -y --no-install-recommends jq ca-certificates freeipmi-tools
env http_proxy=$http_proxy apt-get update
env http_proxy=$http_proxy apt-get install -y --no-install-recommends jq ca-certificates freeipmi-tools
apt-get clean

dpkg -i /mnt/neco_0.0.1_amd64.deb

Expand Down
1 change: 1 addition & 0 deletions dctest/highcpu-menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
core-spine: 10.0.2.0/31
core-external: 10.0.3.0/24
core-operation: 10.0.4.0/24
proxy: 10.0.49.3
exposed:
loadbalancer: 10.72.32.0/20
bastion: 10.72.48.0/26
Expand Down
1 change: 1 addition & 0 deletions dctest/menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ spec:
core-spine: 10.0.2.0/31
core-external: 10.0.3.0/24
core-operation: 10.0.4.0/24
proxy: 10.0.49.3
exposed:
loadbalancer: 10.72.32.0/20
bastion: 10.72.48.0/26
Expand Down
2 changes: 2 additions & 0 deletions dctest/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const (

// DefaultRunTimeout is the timeout value for Agent.Run().
DefaultRunTimeout = 10 * time.Minute

proxy = "http://10.0.49.3:3128"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions dctest/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestSetup() {
env := well.NewEnvironment(context.Background())
env.Go(func(ctx context.Context) error {
stdout, stderr, err := execAt(
boot0, "sudo", "neco", "setup", "--no-revoke", "0", "1", "2")
boot0, "sudo", "neco", "setup", "--no-revoke", "--proxy="+proxy, "0", "1", "2")
if err != nil {
log.Error("neco setup failed", map[string]interface{}{
"host": "boot-0",
Expand All @@ -29,7 +29,7 @@ func TestSetup() {
})
env.Go(func(ctx context.Context) error {
stdout, stderr, err := execAt(
boot1, "sudo", "neco", "setup", "--no-revoke", "0", "1", "2")
boot1, "sudo", "neco", "setup", "--no-revoke", "--proxy="+proxy, "0", "1", "2")
if err != nil {
log.Error("neco setup failed", map[string]interface{}{
"host": "boot-1",
Expand All @@ -42,7 +42,7 @@ func TestSetup() {
})
env.Go(func(ctx context.Context) error {
stdout, stderr, err := execAt(
boot2, "sudo", "neco", "setup", "--no-revoke", "0", "1", "2")
boot2, "sudo", "neco", "setup", "--no-revoke", "--proxy="+proxy, "0", "1", "2")
if err != nil {
log.Error("neco setup failed", map[string]interface{}{
"host": "boot-2",
Expand Down
2 changes: 1 addition & 1 deletion ext/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func ProxyHTTPClient(ctx context.Context, st storage.Storage) (*http.Client, err
// LocalHTTPClient returns a *http.Client to access intranet services.
func LocalHTTPClient() *http.Client {
transport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Proxy: nil,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
Expand Down
2 changes: 1 addition & 1 deletion pkg/neco-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func main() {
}

well.Go(func(ctx context.Context) error {
// NOTE: hack to set http proxy to container/image
// NOTE: hack for github.com/containers/image to set HTTP proxy
st := storage.NewStorage(ec)
proxy, err := st.GetProxyConfig(ctx)
if err != nil && err != storage.ErrNotFound {
Expand Down
11 changes: 11 additions & 0 deletions pkg/neco/cmd/sabakan_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"os"

"github.com/cybozu-go/log"
"github.com/cybozu-go/neco"
Expand All @@ -27,6 +28,16 @@ func sabakanUpload(ctx context.Context, st storage.Storage) error {
}
localClient := ext.LocalHTTPClient()

// NOTE: hack for github.com/containers/image to set HTTP proxy
proxy, err := st.GetProxyConfig(ctx)
if err != nil && err != storage.ErrNotFound {
return err
}
if len(proxy) != 0 {
os.Setenv("http_proxy", proxy)
os.Setenv("https_proxy", proxy)
}

username, err := st.GetQuayUsername(ctx)
if err != nil && err != storage.ErrNotFound {
return err
Expand Down

0 comments on commit 0c025be

Please sign in to comment.