Skip to content

Commit f650ac3

Browse files
authored
Stop setting GOPROXY in Dockerfile (#2736)
* Stop setting GOPROXY in Dockerfile We're seeing failures in CI related to goproxy.io. There's no need to set this so simply don't. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * test: Remove use of global_env fact It's confusing and unnecessary. Place everything in its regular place instead. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * tests: Don't rely on GOPATH This wasn't being set correctly and managing envvars via Ansible is tricky at the best of times. Use hard coded paths instead. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> * tests: Set environment While we figure out why bashrc is not being respected. Signed-off-by: Stephen Finucane <stephenfin@redhat.com> --------- Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
1 parent d228854 commit f650ac3

File tree

13 files changed

+54
-57
lines changed

13 files changed

+54
-57
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ RUN apk add --no-cache ca-certificates
4848
# builder itself is always amd64
4949
FROM --platform=${BUILDPLATFORM} ${GOLANG_IMAGE} AS builder
5050

51-
ARG GOPROXY=https://goproxy.io,direct
5251
ARG TARGETOS
5352
ARG TARGETARCH
5453
ARG VERSION

tests/playbooks/roles/install-cpo-occm/README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ Prerequisites:
55
* The playbook is running on a host with devstack installed.
66
* golang, docker and kubectl should be installed.
77
* docker registry is up and running.
8-
* GOPATH should be configured in {{ global_env }}
9-
* KUBECONFIG should be configured in {{ global_env }}
10-
* k8s cluster is running inside VMs on the devstack host.
8+
* k8s cluster is running inside VMs on the devstack host.
9+
* `~/.kube/config` exists and is pointing at the k8s cluster

tests/playbooks/roles/install-cpo-occm/tasks/main.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
- name: Ensure CPO source folder
2+
- name: Ensure CPO source folder is present
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7-
mkdir -p $GOPATH/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
6+
if [ ! -d "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack" ]; then
7+
echo "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack should exist but does not"
8+
exit 1
99
fi
1010
1111
- name: Build and upload openstack-cloud-controller-manager image
1212
shell:
1313
executable: /bin/bash
1414
cmd: |
15-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
15+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
1616
VERSION="v0.0.99" # Fake version, but in proper format.
1717
1818
make push-multiarch-image-openstack-cloud-controller-manager \
@@ -71,7 +71,7 @@
7171
cmd: |
7272
VERSION="v0.0.99" # Fake version, but in proper format.
7373
74-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
74+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
7575
# replace image with built image
7676
sed -i "s#registry.k8s.io/provider-os/openstack-cloud-controller-manager:[^'\"]\+#{{ remote_registry_host }}/openstack-cloud-controller-manager:${VERSION}#" manifests/controller-manager/openstack-cloud-controller-manager-ds.yaml
7777
sed -i "s#node-role.kubernetes.io/control-plane: \"\"#node-role.kubernetes.io/control-plane: \"true\"#" manifests/controller-manager/openstack-cloud-controller-manager-ds.yaml
@@ -82,7 +82,7 @@
8282
shell:
8383
executable: /bin/bash
8484
cmd: |
85-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
85+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
8686
8787
kubectl apply -f manifests/controller-manager/openstack-cloud-controller-manager-ds.yaml
8888
kubectl apply -f manifests/controller-manager/cloud-controller-manager-roles.yaml
@@ -133,7 +133,7 @@
133133
shell:
134134
executable: /bin/bash
135135
cmd: |
136-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
136+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
137137
138138
# GATEWAY_IP is the default value in devstack
139139
GATEWAY_IP=172.24.5.1 \

tests/playbooks/roles/install-csi-cinder/README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ Prerequisites:
55
* The playbook is running on a host with devstack installed.
66
* golang, docker and kubectl should be installed.
77
* docker registry is up and running.
8-
* GOPATH should be configured in {{ global_env }}
9-
* KUBECONFIG should be configured in {{ global_env }}
108
* k8s cluster is running inside VMs on the devstack host.
9+
* `~/.kube/config` exists and is pointing at the k8s cluster

tests/playbooks/roles/install-csi-cinder/tasks/main.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
- name: Ensure CPO source folder
2+
- name: Ensure CPO source folder is present
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7-
mkdir -p $GOPATH/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
6+
if [ ! -d "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack" ]; then
7+
echo "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack should exist but does not"
8+
exit 1
99
fi
1010
1111
- name: Build and upload cinder-csi-plugin image
1212
shell:
1313
executable: /bin/bash
1414
cmd: |
15-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
15+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
1616
VERSION="v0.0.99" # Fake version, but in proper format.
1717
1818
make push-multiarch-image-cinder-csi-plugin \
@@ -59,7 +59,7 @@
5959
# replace manifest cloud secret file
6060
6161
b64data=`cat {{ ansible_user_dir }}/cloud.conf | base64 -w 0`
62-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
62+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
6363
6464
sed -i "/cloud\.conf/c\ cloud.conf: $b64data" manifests/cinder-csi-plugin/csi-secret-cinderplugin.yaml
6565
@@ -74,7 +74,7 @@
7474
shell:
7575
executable: /bin/bash
7676
cmd: |
77-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
77+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
7878
kubectl apply -f manifests/cinder-csi-plugin
7979
ignore_errors: true
8080

@@ -180,7 +180,7 @@
180180
set -e
181181
set -o pipefail
182182
183-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
183+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
184184
mkdir -p /var/log/csi-pod
185185
# TODO(chrigl): No idea why both tests fail in CI. On a real OpenStack both pass.
186186
/tmp/kubernetes/test/bin/e2e.test \

tests/playbooks/roles/install-csi-manila/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Prerequisites:
55
* The playbook is running on a host with devstack installed.
66
* golang, docker and kubectl should be installed.
77
* docker registry is up and running.
8-
* KUBECONFIG should be configured in {{ global_env }}
98
* k8s cluster is running inside VMs on the devstack host.
9+
* `~/.kube/config` exists and is pointing at the k8s cluster

tests/playbooks/roles/install-csi-manila/tasks/main.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
2-
- name: Ensure CPO source folder
2+
- name: Ensure CPO source folder is present
33
shell:
44
executable: /bin/bash
55
cmd: |
6-
if [ ! -d $GOPATH/src/k8s.io/cloud-provider-openstack ]; then
7-
mkdir -p $GOPATH/src/k8s.io; cd $_
8-
git clone https://github.com/kubernetes/cloud-provider-openstack
6+
if [ ! -d "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack" ]; then
7+
echo "{{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack should exist but does not"
8+
exit 1
99
fi
1010
1111
- name: Build and upload manila-csi-plugin image
1212
shell:
1313
executable: /bin/bash
1414
cmd: |
15-
cd $GOPATH/src/k8s.io/cloud-provider-openstack
15+
cd {{ ansible_user_dir }}/src/k8s.io/cloud-provider-openstack
1616
VERSION="v0.0.99" # Fake version, but in proper format.
1717
1818
make push-multiarch-image-manila-csi-plugin \

tests/playbooks/roles/install-golang/tasks/main.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@
2626
when:
2727
- curr_go_version.stdout != go_version
2828

29-
- name: Set golang env vars
30-
set_fact:
31-
golang_env:
32-
GOPATH: '{{ ansible_user_dir }}'
33-
PATH: '/usr/local/go/bin:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}'
29+
- name: Set GOPATH
30+
lineinfile:
31+
path: ~/.bashrc
32+
line: 'export GOPATH=$HOME'
33+
create: true
34+
state: present
3435

35-
- name: Merge golang env vars into global env
36-
set_fact:
37-
global_env: '{{ global_env | combine(golang_env) }}'
36+
- name: Add go binary path to PATH
37+
lineinfile:
38+
path: ~/.bashrc
39+
line: 'export PATH=/usr/local/go/bin:{{ ansible_user_dir }}/bin:$PATH'
40+
create: true
41+
state: present

tests/playbooks/roles/install-k3s-bare-single/tasks/main.yaml

+9-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@
4545
retries: 12
4646
delay: 10
4747

48-
- name: Set kubeconfig env
49-
set_fact:
50-
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
48+
- name: Create ~/.kube directory
49+
ansible.builtin.file:
50+
path: ~/.kube
51+
state: directory
5152

52-
- name: Merge KUBECONFIG env vars into global env
53-
set_fact:
54-
global_env: "{{ global_env | combine({'KUBECONFIG': kubeconfig}) }}"
53+
- name: Copy kubeconfig to ~/.kube
54+
ansible.builtin.copy:
55+
src: /etc/rancher/k3s/k3s.yaml
56+
dest: ~/.kube/config
57+
remote_src: true

tests/playbooks/roles/install-k3s/tasks/main.yaml

-8
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,3 @@
175175
until: result.stdout == (worker_node_count + 1)|string
176176
retries: 12
177177
delay: 10
178-
179-
- name: Set kubeconfig env
180-
set_fact:
181-
kubeconfig: "{{ ansible_user_dir }}/.kube/config"
182-
183-
- name: Merge KUBECONFIG env vars into global env
184-
set_fact:
185-
global_env: "{{ global_env | combine({'KUBECONFIG': kubeconfig}) }}"

tests/playbooks/test-csi-cinder-e2e.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
vars:
77
e2e_test_version: v1.31.2
88
user: stack
9-
global_env: {}
109
devstack_workdir: /home/{{ user }}/devstack
1110

1211
roles:
@@ -24,6 +23,8 @@
2423
worker_node_count: 0
2524
- role: install-cpo-occm
2625
run_e2e: false
27-
environment: "{{ global_env }}"
2826
- role: install-csi-cinder
29-
environment: "{{ global_env }}"
27+
environment:
28+
GOPATH: '{{ ansible_user_dir }}'
29+
PATH: '/usr/local/go/bin:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}'
30+
KUBECONFIG: '{{ ansible_user_dir }}/.kube/config'

tests/playbooks/test-csi-manila-e2e.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
vars:
77
user: stack
8-
global_env: {}
98
devstack_workdir: /home/{{ user }}/devstack
109

1110
roles:
@@ -25,4 +24,7 @@
2524
run_e2e: false
2625
- role: install-helm
2726
- role: install-csi-manila
28-
environment: "{{ global_env }}"
27+
environment:
28+
GOPATH: '{{ ansible_user_dir }}'
29+
PATH: '/usr/local/go/bin:{{ ansible_user_dir }}/bin:{{ ansible_env.PATH }}'
30+
KUBECONFIG: '{{ ansible_user_dir }}/.kube/config'

tests/playbooks/test-occm-e2e.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
vars:
77
user: stack
8-
global_env: {}
98
devstack_workdir: /home/{{ user }}/devstack
109
octavia_provider: ""
1110

@@ -28,4 +27,3 @@
2827
- role: install-cpo-occm
2928
run_e2e: "{{ run_e2e }}"
3029
octavia_provider: "{{ octavia_provider }}"
31-
environment: "{{ global_env }}"

0 commit comments

Comments
 (0)