Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement basic continuous integration test
See ukf/ukf-meta#384.
iay committed Apr 13, 2023
1 parent 56b4ec3 commit db36e51
Showing 4 changed files with 117 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .gitlab-ci.yml
@@ -0,0 +1,55 @@
#
# Continuous integration tests for the ukf-meta repository.
#

#
# Default image for all steps is Amazon Corretto 11, which is based
# on Amazon Linux (a variety of yum-based Linux derived from RHEL 7).
#
image: "amazoncorretto:11"

stages:
- test

perform-test:
stage: test
script:
#
# Install the tools we need that are not provided by the base image.
#
- yum -y --quiet install ant git libxslt

#
# Create work directories under the current one.
#
- mkdir -p work/build work/temp

#
# Fetch full UK federation inventory.
#
# The clone is made with a depth of 1 because we don't need any history.
#
- git clone --depth=1 https://gitlab-ci-token:$CI_JOB_TOKEN@$CI_SERVER_HOST/ukf/ukf-data.git work/ukf-data

#
# Thin UK federation inventory: retain 100 random entities.
#
- find work/ukf-data/entities -type f -name uk0\*.xml | sort -R | tail -n +101 | xargs rm

#
# Acquire a copy of the eduGAIN aggregate.
#
- ant -Denv=ci-download flow.edugain.download
- ls -lh work/temp

#
# Thin the eduGAIN aggregate into another file containing just 1% of the original
# entities.
#
- xsltproc -o work/temp/edugain-thin.xml utilities/thin_aggregate.xsl work/temp/edugain-download.xml
- ls -lh work/temp

#
# Run the full generate pipeline on the thinned input data.
#
- ant -Denv=ci-thin flow.aggregates.generate
15 changes: 15 additions & 0 deletions ci-download.properties
@@ -0,0 +1,15 @@
#
# ci-download.properties
#
# Properties defined for the env=ci-download environment, the part of the
# continuous integration job that downloads an eduGAIN aggregate.
#

# Shared workspace location is assumed to be under the current directory.
shared.ws.dir=${basedir}/work

#
# Cached eduGAIN download goes into a different directory so that it
# persists over comparison runs.
#
mda.output.edugain.download=${shared.ws.dir}/temp/edugain-download.xml
14 changes: 14 additions & 0 deletions ci-thin.properties
@@ -0,0 +1,14 @@
#
# ci-thin.properties
#
# Properties defined for the env=ci-thin environment, the part of the
# continuous integration job that runs the test on the thinned data.
#

# Shared workspace location is assumed to be under the current directory.
shared.ws.dir=${basedir}/work

#
# Location of the thinned version of the downloaded eduGAIN aggregate.
#
mda.output.edugain.download=${shared.ws.dir}/temp/edugain-thin.xml
33 changes: 33 additions & 0 deletions utilities/thin_aggregate.xsl
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
thin_aggregate.xsl
Thins the input aggregate so that only 1% of the entities remain.
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:math="http://exslt.org/math">

<!--
Force UTF-8 encoding for the output.
-->
<xsl:output omit-xml-declaration="no" method="xml" encoding="UTF-8"/>

<!-- Discard most entities. -->
<xsl:template match="md:EntityDescriptor[math:random()>0.01]">
<!-- discard -->
</xsl:template>

<!--By default, copy text blocks, comments and attributes unchanged.-->
<xsl:template match="text()|comment()|@*">
<xsl:copy/>
</xsl:template>

<!--By default, copy all elements from the input to the output, along with their attributes and contents.-->
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

0 comments on commit db36e51

Please sign in to comment.