Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Setup with GitHub Actions and NGINX Perl Test Updates #19

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
58 changes: 58 additions & 0 deletions .github/workflows/ci-functional-perl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI for NJS-based SAML Implementation
run-name: ${{ github.actor }} is triggering pipeline
on: [push]

jobs:
test-njs-saml:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install prerequisites
run: |
sudo apt-get update
sudo apt-get install -y apt-transport-https lsb-release apt-utils ubuntu-keyring gnupg2 \
ca-certificates wget mercurial

- name: Prepare keys and certificates
run: |
sudo mkdir /etc/ssl/nginx
echo '${{ secrets.NGINX_REPO_CRT }}' | sudo tee /etc/ssl/nginx/nginx-repo.crt > /dev/null
jimf5 marked this conversation as resolved.
Show resolved Hide resolved
echo '${{ secrets.NGINX_REPO_KEY }}' | sudo tee /etc/ssl/nginx/nginx-repo.key > /dev/null

- name: Configure NGINX Plus repository
run: |
wget --certificate=/etc/ssl/nginx/nginx-repo.crt --private-key=/etc/ssl/nginx/nginx-repo.key \
https://pkgs-test.nginx.com/keys/nginx_test_signing.key
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/nginx_test_signing.gpg \
--import nginx_test_signing.key
echo "Acquire::https::pkgs-test.nginx.com::Verify-Peer \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90nginx
echo "Acquire::https::pkgs-test.nginx.com::Verify-Host \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90nginx
echo "Acquire::https::pkgs-test.nginx.com::SslCert \"/etc/ssl/nginx/nginx-repo.crt\";" \
| sudo tee -a /etc/apt/apt.conf.d/90nginx
echo "Acquire::https::pkgs-test.nginx.com::SslKey \"/etc/ssl/nginx/nginx-repo.key\";" \
| sudo tee -a /etc/apt/apt.conf.d/90nginx
printf "deb [signed-by=/usr/share/keyrings/nginx_test_signing.gpg] \
https://pkgs-test.nginx.com/nightly/ubuntu $(lsb_release -cs) nginx-plus\n" \
| sudo tee /etc/apt/sources.list.d/nginx-plus.list

- name: Install NGINX Plus
run: |
sudo apt-get update
sudo apt-get install -y nginx-plus nginx-plus-module-njs

- name: Install required Perl modules
run: |
sudo apt-get install -y perl libxml-libxml-perl libdatetime-perl libcrypt-openssl-x509-perl \
libcrypt-openssl-rsa-perl

- name: Checkout nginx-test
run: |
hg clone http://hg.nginx.org/nginx-tests/

- name: Run tests
working-directory: t
run: |
PERL5LIB=../nginx-tests/lib TEST_NGINX_BINARY=/usr/sbin/nginx TEST_NGINX_VERBOSE=1 \
TEST_NGINX_GLOBALS="load_module /etc/nginx/modules/ngx_http_js_module-debug.so;" prove -v .
4 changes: 2 additions & 2 deletions t/js_saml.t
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ select STDOUT; $| = 1;
eval { require JSON::PP; };
plan(skip_all => "JSON::PP not installed") if $@;

my $t = Test::Nginx->new()->has(qw/http rewrite proxy gzip api keyval/)
my $t = Test::Nginx->new()->has(qw/http rewrite proxy gzip/)
jimf5 marked this conversation as resolved.
Show resolved Hide resolved
->write_file_expand('nginx.conf', <<'EOF');

%%TEST_GLOBALS%%
Expand Down Expand Up @@ -440,7 +440,7 @@ like(get('/', auth_token => get_auth_token($r)), qr/Welcome user1/,

cfg_post({saml_idp_verification_certificate => "$d/sp.example.com.key"});
$r = init_sso($cfg);
like($r, qr/500.*Error verifying.*signature.*error:Type=X509_PUBKEY/s,
like($r, qr/500.*Error verifying Response message signature/s,
'wrong cert type');

cfg_post({saml_idp_verification_certificate => "not_found"});
Expand Down