Skip to content

Commit 486c501

Browse files
authored
Merge pull request #24 from solarwindscloud/NH-27837-d
NH-27837: arm support + verify_install script
2 parents e8a8970 + 3efda5b commit 486c501

File tree

4 files changed

+185
-32
lines changed

4 files changed

+185
-32
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @cheempz @xuan-cao-swi @tammy-baylis-swi @solarwindscloud/apm-instrumentation
1+
* @solarwindscloud/apm-instrumentation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env sh
2+
3+
# stop on error
4+
set -e
5+
6+
echo "Install solarwinds_apm version: $SOLARWINDS_APM_VERSION"
7+
8+
{
9+
if grep rhel /etc/os-release; then
10+
# for special ubi now. next liboboe version we will build our own rhel image
11+
yum update -y && yum install -y ruby-devel git-core gcc gcc-c++ make perl zlib-devel bzip2 openssl-devel
12+
13+
git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
14+
&& git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build \
15+
&& git clone https://github.com/rbenv/rbenv-default-gems.git ~/.rbenv/plugins/rbenv-default-gems \
16+
&& echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile \
17+
&& echo 'eval "$(rbenv init -)"' >> ~/.profile \
18+
&& echo 'eval "$(rbenv init -)"' >> ~/.bashrc \
19+
&& echo 'bundler' > ~/.rbenv/default-gems
20+
21+
echo 'alias be="bundle exec"' >> ~/.bashrc
22+
echo 'alias be="bundle exec"' >> ~/.profile
23+
24+
. ~/.profile \
25+
&& cd /root/.rbenv/plugins/ruby-build && git pull && cd - \
26+
&& rbenv install $RUBY_VERSION
27+
28+
rbenv global $RUBY_VERSION
29+
fi
30+
} >/dev/null
31+
32+
rbenv local $RUBY_VERSION
33+
34+
if [ "$MODE" = "RubyGem" ]; then
35+
echo "RubyGem"
36+
gem install solarwinds_apm -v "$SOLARWINDS_APM_VERSION"
37+
elif [ "$MODE" = "packagecloud" ]; then
38+
echo "packagecloud"
39+
gem install solarwinds_apm -v "$SOLARWINDS_APM_VERSION" --source https://packagecloud.io/solarwinds/solarwinds-apm-ruby/
40+
fi
41+
42+
ruby ./home/.github/workflows/scripts/test_install.rb

.github/workflows/verify_install.yml

+129-27
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,145 @@ name: Verify Installation
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
install-registry:
7+
required: true
8+
description: 'Registry used for install tests, e.g. RubyGem, packagecloud'
9+
type: choice
10+
default: 'RubyGem'
11+
options:
12+
- RubyGem
13+
- packagecloud
514

6-
7-
env:
8-
SW_APM_SERVICE_KEY: ${{ secrets.SW_APM_SERVICE_KEY_PROD }}
9-
SW_APM_COLLECTOR: ${{ secrets.SW_APM_COLLECTOR_PROD}}
15+
solarwinds-version:
16+
required: true
17+
description: 'Solarwinds apm version'
1018

1119
jobs:
12-
#--------------------------------------------------------------------
13-
# RUBY 3.1
14-
#--------------------------------------------------------------------
1520

16-
ruby31_install_ubuntu_20:
21+
verify_install_amd64_test:
22+
name: ruby - ${{ matrix.ruby_version }} - ${{ matrix.os }} amd64 - ${{ github.event.inputs.solarwinds-version }}
23+
runs-on: ubuntu-latest
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
os: [ubuntu, alpine]
29+
ruby_version: ['3.1.0', '2.7.5']
30+
steps:
31+
- uses: actions/checkout@v3
32+
33+
- name: Log in to the Container Registry
34+
uses: docker/login-action@v2
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- run: docker pull --platform linux/amd64 ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }}:latest
41+
42+
- name: Run tests in container
43+
run: |
44+
sudo docker run \
45+
--platform linux/amd64 \
46+
-e SW_APM_SERVICE_KEY=${{ secrets.SW_APM_SERVICE_KEY_PROD }} \
47+
-e SW_APM_COLLECTOR=${{ secrets.SW_APM_COLLECTOR_PROD }} \
48+
-e SOLARWINDS_APM_VERSION=${{ github.event.inputs.solarwinds-version }} \
49+
-e PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} \
50+
-e MODE=${{ github.event.inputs.install-registry }} \
51+
-e RUBY_VERSION=${{ matrix.ruby_version }} \
52+
-v $(pwd):/home \
53+
--rm ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }}:nh-27837-b \
54+
./home/.github/workflows/scripts/_helper_run_install_tests.sh
55+
56+
57+
verify_install_arm64_test:
58+
name: ruby - ${{ matrix.ruby_version }} - ${{ matrix.os }} arm64 - ${{ github.event.inputs.solarwinds-version }}
1759
runs-on: ubuntu-latest
18-
container:
19-
image: ruby:3.1.3-bullseye
60+
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
os: [ubuntu, alpine]
65+
ruby_version: ['3.1.0', '2.7.5']
66+
2067
steps:
21-
- uses: actions/checkout@v2
22-
- name: Setup and run install test
23-
working-directory: .github/workflows/
68+
- uses: actions/checkout@v3
69+
- uses: docker/setup-qemu-action@v2
70+
71+
- name: Log in to the Container Registry
72+
uses: docker/login-action@v2
73+
with:
74+
registry: ghcr.io
75+
username: ${{ github.repository_owner }}
76+
password: ${{ secrets.GITHUB_TOKEN }}
77+
78+
- run: docker pull --platform linux/arm64 ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }}:latest
79+
80+
- name: Run tests in container using QEMU
2481
run: |
25-
sleep 1
26-
gem install solarwinds_apm
27-
ruby ./scripts/test_install.rb
82+
sudo docker run \
83+
--platform linux/arm64 \
84+
-e SW_APM_SERVICE_KEY=${{ secrets.SW_APM_SERVICE_KEY_PROD }} \
85+
-e SW_APM_COLLECTOR=${{ secrets.SW_APM_COLLECTOR_PROD }} \
86+
-e SOLARWINDS_APM_VERSION=${{ github.event.inputs.solarwinds-version }} \
87+
-e PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} \
88+
-e MODE=${{ github.event.inputs.install-registry }} \
89+
-e RUBY_VERSION=${{ matrix.ruby_version }} \
90+
-v $(pwd):/home \
91+
--rm ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }}:nh-27837-b \
92+
./home/.github/workflows/scripts/_helper_run_install_tests.sh
2893
29-
ruby31_install_ubuntu_20_arm:
94+
verify_install_ubi8_amd64_test:
95+
name: ruby - ${{ matrix.ruby_version }} - ubi8 amd64 - ${{ github.event.inputs.solarwinds-version }}
3096
runs-on: ubuntu-latest
31-
container:
32-
image: arm64v8/ruby:3.1.3-bullseye
97+
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
ruby_version: [3.1.0, 2.7.5]
102+
33103
steps:
34-
- name: Set up QEMU
35-
uses: docker/setup-qemu-action@v2
104+
- uses: actions/checkout@v3
105+
- run: docker pull redhat/ubi8
106+
- name: Run tests in ubi8 container
107+
run: |
108+
sudo docker run \
109+
--platform linux/amd64 \
110+
-e RUBY_VERSION=${{ matrix.ruby_version }} \
111+
-e SW_APM_SERVICE_KEY=${{ secrets.SW_APM_SERVICE_KEY_PROD }} \
112+
-e SW_APM_COLLECTOR=${{ secrets.SW_APM_COLLECTOR_PROD }} \
113+
-e SOLARWINDS_APM_VERSION=${{ github.event.inputs.solarwinds-version }} \
114+
-e PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} \
115+
-e MODE=${{ github.event.inputs.install-registry }} \
116+
-v $(pwd):/home \
117+
--rm redhat/ubi8 \
118+
./home/.github/workflows/scripts/_helper_run_install_tests.sh
36119
37-
- uses: actions/checkout@v2
120+
verify_install_ubi8_arm64_test:
121+
name: ruby - ${{ matrix.ruby_version }} - ubi8 arm64 - ${{ github.event.inputs.solarwinds-version }}
122+
runs-on: ubuntu-latest
123+
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
ruby_version: [3.1.0, 2.7.5]
38128

39-
- name: Setup and run install test
40-
working-directory: .github/workflows/
129+
steps:
130+
- uses: actions/checkout@v3
131+
- uses: docker/setup-qemu-action@v2
132+
- run: docker pull --platform linux/arm64 redhat/ubi8
133+
- name: Run tests in ubi8 container using QEMU
41134
run: |
42-
sleep 1
43-
gem install solarwinds_apm
44-
ruby ./scripts/test_install.rb
135+
sudo docker run \
136+
--platform linux/arm64 \
137+
-e RUBY_VERSION=${{ matrix.ruby_version }} \
138+
-e SW_APM_SERVICE_KEY=${{ secrets.SW_APM_SERVICE_KEY_PROD }} \
139+
-e SW_APM_COLLECTOR=${{ secrets.SW_APM_COLLECTOR_PROD }} \
140+
-e SOLARWINDS_APM_VERSION=${{ github.event.inputs.solarwinds-version }} \
141+
-e PACKAGECLOUD_TOKEN=${{ secrets.PACKAGECLOUD_TOKEN }} \
142+
-e MODE=${{ github.event.inputs.install-registry }} \
143+
-v $(pwd):/home \
144+
--rm redhat/ubi8 \
145+
./home/.github/workflows/scripts/_helper_run_install_tests.sh
146+

ext/oboe_metal/extconf.rb

+13-4
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,24 @@
3737
ao_path = File.join('https://agent-binaries.cloud.solarwinds.com/apm/c-lib/', version)
3838
end
3939

40-
ao_arch = 'x86_64'
40+
ao_arch = "x86_64"
41+
system_arch = `uname -m` # for mac, the command is `uname` # "Darwin\n"; try `uname -a`
42+
case system_arch.gsub("\n","")
43+
when "x86_64"
44+
ao_arch = "x86_64"
45+
when "aarch64"
46+
ao_arch = "aarch64"
47+
end
48+
4149
if File.exist?('/etc/alpine-release')
4250
version = File.read('/etc/alpine-release').strip
4351

52+
tmp_ao_arch = ao_arch.clone
4453
ao_arch =
4554
if Gem::Version.new(version) < Gem::Version.new('3.9')
46-
'alpine-libressl-x86_64'
55+
"alpine-libressl-#{tmp_ao_arch}"
4756
else # openssl
48-
'alpine-x86_64'
57+
"alpine-#{tmp_ao_arch}"
4958
end
5059
end
5160

@@ -142,4 +151,4 @@
142151
$stderr.puts '=================================================================='
143152
create_makefile('oboe_noop', 'noop')
144153
end
145-
end
154+
end

0 commit comments

Comments
 (0)