Skip to content

Commit

Permalink
fix: Improved performance when printing logs in Output Channel
Browse files Browse the repository at this point in the history
  • Loading branch information
Aerex authored Apr 11, 2022
2 parents 016226b + a795334 commit 07553a5
Show file tree
Hide file tree
Showing 14 changed files with 532 additions and 282 deletions.
17 changes: 14 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$|package-lock.json",
"lines": null
},
"generated_at": "2022-01-12T18:12:20Z",
"generated_at": "2022-04-05T14:36:20Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -76,8 +76,19 @@
"name": "TwilioKeyDetector"
}
],
"results": {},
"version": "0.13.1+ibm.46.dss",
"results": {
"ci/Dockerfile": [
{
"hashed_secret": "b991a3507ae53155dfb37a8c817f74f847d66043",
"is_verified": false,
"is_secret": false,
"line_number": 56,
"type": "Secret Keyword",
"verified_result": null
}
]
},
"version": "0.13.1+ibm.47.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
sudo: false

services:
- docker

language: node_js

node_js: node

os:
- linux

before_install:
- if [ $TRAVIS_OS_NAME == "linux" ]; then
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y;
sudo apt-get update -q;
sudo apt-get install libstdc++-4.9-dev -y;
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0;
sh -e /etc/init.d/xvfb start;
sleep 3;
fi

script:
- npm test --silent
docker build -t vscode-build -f ci/Dockerfile .;
docker run vscode-build /bin/sh -c 'xvfb-run -a -l --server-args=":99 -screen 0 1024x786x24" npm test';

deploy:
provider: script
Expand Down
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.vscode-test/**
out/test/**
test/**
ci/**
src/**
**/*.map
.gitignore
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
This extension provides capabilities for the [IBM Cloud CLI](https://cloud.ibm.com/docs/cli/index.html) from directly within the VS Code editor. Use the VS Code command palette to quickly access all `ibmcloud dev` commands, without the need to leave the editor's context.

## Changelog
- v0.0.16
- Improved performance when displaying CLI logs in Output Channel
- Used correct command ext identifier when calling cf logs commands
- *v0.0.15*
- Updated to IBM Cloud 2.6.0
- Rebranded extension to IBM Cloud CLI
Expand Down
77 changes: 77 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM registry.access.redhat.com/ubi8/ubi:8.5-236.1648460182

ARG DEBIAN_FRONTEND=noninteractive

RUN groupadd --gid 1000 builduser \
&& useradd --uid 1000 --gid builduser --shell /bin/bash --create-home builduser \
&& mkdir -p /setup

# Set up TEMP directory
ENV TEMP=/tmp
RUN chmod a+rwx /tmp

# Install packages needed to run vscode headless
RUN yum update -q && yum install -y \
yum-utils \
git \
iproute \
fuse\
vim \
gdk-pixbuf2 \
glibc-devel \
gtk3\
alsa-lib\
libsecret \
openssl-devel \
libX11-devel \
libXScrnSaver \
mesa-libgbm\
nss\
at-spi2-atk\
libX11-xcb \
lsof \
python3-pip \
sudo \
wget \
unzip

# Add centos8 to mirrorlist
RUN yum-config-manager --add-repo https://vault.centos.org/centos/8/AppStream/x86_64/os

# Downloand and import CentOS8 GPG keys
RUN wget "https://centos.org/keys/RPM-GPG-KEY-CentOS-Official" \
&& rpm --import RPM-GPG-KEY-CentOS-Official

# No Sudo Prompt
RUN echo 'builduser ALL=NOPASSWD: ALL' >> /etc/sudoers.d/50-builduser \
&& echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep

# Install Xvfb
RUN yum install xorg-x11-server-Xvfb -y

# Node
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash -
RUN yum install -y nodejs

# Set python3 as default
RUN alternatives --set python /usr/bin/python3

# Setup dbus path and config
RUN rm -rf /var/run/dbus && mkdir -p /var/run/dbus
COPY ci/dbus-policy.conf /etc/dbus-1/system.d/

# Copy entrypoint dbus-dameon script
COPY --chown=builduser:builduser ci/entrypoint.sh /etc/init.d/dbus-session
RUN chmod +x /etc/init.d/dbus-session

# Allow acccess to dbus socket for builduser
RUN chown builduser:builduser -R /var/run/dbus/
ENV DBUS_SESSION_BUS_ADDRESS="unix:path=/var/run/dbus/system_bus_socket"
ENV DISPLAY :99.0

COPY --chown=builduser:builduser . /home/builduser/

USER builduser
WORKDIR /home/builduser

ENTRYPOINT ["/etc/init.d/dbus-session"]
119 changes: 119 additions & 0 deletions ci/dbus-policy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<!-- This configuration file controls the systemwide message bus.
Add a system-local.conf and edit that rather than changing this
file directly. -->

<!-- Note that there are any number of ways you can hose yourself
security-wise by screwing up this file; in particular, you
probably don't want to listen on any more addresses, add any more
auth mechanisms, run as a different user, etc. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

<!-- Our well-known bus type, do not change this -->
<type>system</type>

<!-- Run as special user -->
<user>dbus</user>

<!-- Fork into daemon mode -->
<fork/>

<!-- We use system service launching using a helper -->
<standard_system_servicedirs/>

<!-- This is a setuid helper that is used to launch system services -->
<servicehelper>/usr/lib/dbus-1.0/dbus-daemon-launch-helper</servicehelper>

<!-- Write a pid file -->
<pidfile>/var/run/dbus/pid</pidfile>

<!-- Enable logging to syslog -->
<syslog/>

<!-- Only allow socket-credentials-based authentication -->
<auth>EXTERNAL</auth>

<!-- Only listen on a local socket. (abstract=/path/to/socket
means use abstract namespace, don't really create filesystem
file; only Linux supports this. Use path=/whatever on other
systems.) -->
<listen>unix:path=/var/run/dbus/system_bus_socket</listen>

<policy context="default">
<!-- All users can connect to system bus -->
<allow user="*"/>

<!-- Holes must be punched in service configuration files for
name ownership and sending method calls -->
<deny own="*"/>
<deny send_type="method_call"/>

<!-- Signals and reply messages (method returns, errors) are allowed
by default -->
<allow send_type="signal"/>
<allow send_requested_reply="true" send_type="method_return"/>
<allow send_requested_reply="true" send_type="error"/>

<!-- All messages may be received by default -->
<allow receive_type="method_call"/>
<allow receive_type="method_return"/>
<allow receive_type="error"/>
<allow receive_type="signal"/>

<!-- Allow anyone to talk to the message bus -->
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus" />
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Introspectable"/>
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Properties"/>
<!-- But disallow some specific bus services -->
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus"
send_member="UpdateActivationEnvironment"/>
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Debug.Stats"/>
<deny send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.systemd1.Activator"/>
</policy>

<!-- Only systemd, which runs as root, may report activation failures. -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.systemd1.Activator"/>
</policy>

<!-- root may monitor the system bus. -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Monitoring"/>
</policy>

<!-- If the Stats interface was enabled at compile-time, root may use it.
Copy this into system.local.conf or system.d/*.conf if you want to
enable other privileged users to view statistics and debug info -->
<policy user="root">
<allow send_destination="org.freedesktop.DBus"
send_interface="org.freedesktop.DBus.Debug.Stats"/>
</policy>

<!-- Include legacy configuration that was preserved in a Debian upgrade,
if any -->
<include ignore_missing="yes">/etc/dbus-1/system.conf.dpkg-bak</include>

<!-- The defaults for these limits are hard-coded in dbus-daemon.
Some clarifications:
Times are in milliseconds (ms); 1000ms = 1 second
133169152 bytes = 127 MiB
33554432 bytes = 32 MiB
150000ms = 2.5 minutes -->

<!-- Config files are placed here that among other things, punch
holes in the above policy for specific services. -->


<include if_selinux_enabled="yes" selinux_root_relative="yes">contexts/dbus_contexts</include>

</busconfig>
7 changes: 7 additions & 0 deletions ci/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
if [[ ! -f /var/run/dbus/system_bus_socket ]]; then
export DISPLAY=:99.0
dbus-daemon --config-file /etc/dbus-1/system.d/dbus-policy.conf &
fi

exec "$@"
Loading

0 comments on commit 07553a5

Please sign in to comment.