Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
ansible.builtin.add_host:
hostname: "{{ remote_ip }}"
groups: [remote_host]
when: remote_ip | ansible.utils.ipaddr
when: (remote_ip | default('')) | ansible.utils.ipaddr != false

- name: Wait for host tasks
ansible.builtin.include_tasks: tasks/wait-for-host.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
ansible.builtin.add_host:
hostname: "{{ access_ip.stdout }}"
groups: [remote_host]
when: access_ip.stdout | ansible.utils.ipaddr
when: (access_ip.stdout | default('')) | ansible.utils.ipaddr != false
## Setup firewall for cloud build
- name: Create firewall rule
register: fw_result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
ansible.builtin.add_host:
hostname: "{{ login_ip }}"
groups: [remote_host]
when: login_ip | ansible.utils.ipaddr
when: (login_ip | default('')) | ansible.utils.ipaddr != false

- name: Wait for host tasks
ansible.builtin.include_tasks: tasks/wait-for-host.yml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
---
- name: Gather instance information
delegate_to: localhost
when: deployment_name is defined and deployment_name | string
when: deployment_name is defined and deployment_name | length > 0
changed_when: false
register: instances
until: instances.rc == 0
Expand All @@ -30,7 +30,7 @@
ansible.builtin.debug:
var: instances.stdout
- name: Print Cloud Logging command
when: instances is defined and instances.stdout | list
when: instances is defined and (instances.stdout | from_json | length > 0)
ansible.builtin.debug:
msg: gcloud logging --project {{ project }} read 'logName="projects/{{ project }}/logs/google_metadata_script_runner" AND resource.labels.instance_id="{{ item.id }}"' --format="table(timestamp, jsonPayload.message)" --freshness 24h | tac
loop: "{{ instances.stdout }}"
loop: "{{ instances.stdout | from_json | default([]) }}"
29 changes: 16 additions & 13 deletions tools/cloud-build/images/test-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:bullseye
FROM golang:trixie

ENV GOCACHE=/ghpc_go_cache

# copy the source code, to build the binary
# use `/workspace` to match path in cache for future builds
COPY ./ /workspace

RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add - && \
apt-get -y update && apt-get -y install \
# `software-properties-common` providers `add-apt-repository`
software-properties-common \
RUN apt-get -y update && apt-get -y install \
gnupg \
keychain \
# `dnsutils` provides `dig` used by integration tests
dnsutils && \
# install terraform and packer
apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com bullseye main" && \
curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg && \
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com trixie main" | tee /etc/apt/sources.list.d/hashicorp.list && \
apt-get -y update && \
# Pin Terraform version to 1.12.2
apt-get install -y unzip python3-pip python3-netaddr terraform=1.12.2-1 packer jq && \
apt-get install -y unzip python3-pip python3-venv terraform=1.12.2-1 packer jq && \
# install gcloud
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" \
| tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \
apt-get -y update && apt-get -y install google-cloud-sdk && \
apt-get -y install kubectl && \
# following is required to execute kubectl commands
apt-get -y install google-cloud-cli-gke-gcloud-auth-plugin && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
# create virtual environment
python3 -m venv /opt/venv && \
# install ansible and python dependencies
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r https://raw.githubusercontent.com/GoogleCloudPlatform/slurm-gcp/master/scripts/requirements.txt && \
pip install --no-cache-dir ansible && \
pip install --no-cache-dir paramiko && \
/opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
/opt/venv/bin/pip install --no-cache-dir -r https://raw.githubusercontent.com/GoogleCloudPlatform/slurm-gcp/master/scripts/requirements.txt && \
/opt/venv/bin/pip install --no-cache-dir ansible && \
/opt/venv/bin/pip install --no-cache-dir paramiko && \
/opt/venv/bin/pip install --no-cache-dir netaddr && \
rm -rf ~/.cache/pip/* && \
# compile the binary to warm up `/ghpc_go_cache`
cd /workspace && make gcluster && \
# remove /workspace to reduce image size
rm -rf /workspace

ENV PATH="/opt/venv/bin:$PATH"
Loading