Skip to content
Open
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
19 changes: 0 additions & 19 deletions .github/dependabot.template.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/dependabot.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .github/workflows/add-dependabot-pr-to-project.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/generate-dependabot.yml

This file was deleted.

73 changes: 5 additions & 68 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
puppet-4-10-10:
puppet-8-28-1:
env:
PUPPET_VERSIONS: "4.10.10"
PUPPET_VERSION: "4.10.10"
PUPPET_VERSIONS: "8.28.1"
PUPPET_VERSION: "8.28.1"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
Expand All @@ -13,73 +13,10 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ["2.6"]
ruby-version: ["3.2.11"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

puppet-5-5-22:
env:
PUPPET_VERSIONS: "5.5.22"
PUPPET_VERSION: "5.5.22"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
ruby-version: ["2.6"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

puppet-6-18-0:
env:
PUPPET_VERSIONS: "6.18.0"
PUPPET_VERSION: "6.18.0"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
ruby-version: ["2.6"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

puppet-7-3-0:
env:
PUPPET_VERSIONS: "7.3.0"
PUPPET_VERSION: "7.3.0"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
ruby-version: ["2.6"]
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v7
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- name: Tests
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v7
- name: Set up Ruby
uses: ruby/setup-ruby@a6b46b8a08edb18935835849f2a17072d5cc8c73 # v1.192.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
ruby-version: '3.2.11'
bundler-cache: true
- run: bundle install

- name: Publish to GPR
Expand All @@ -36,7 +38,7 @@ jobs:
*.gem
fi
- name: Upload gem as action artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
path: ./*.gem
121 changes: 121 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
stages:
- build
- publish

default:
image: ruby:3.2.11

variables:
FF_SCRIPT_SECTIONS: "true"

build:gem:
stage: build
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
- if: '$CI_COMMIT_TAG'
before_script:
- export VERSION=$(cat .version | tr -d '[:space:]')
- echo "Building octocatalog-diff version ${VERSION}"
script:
- gem build *.gemspec
artifacts:
name: "octocatalog-diff-${CI_COMMIT_REF_SLUG}"
paths:
- "*.gem"
expire_in: 1 week

publish:gem:stage:
stage: publish
rules:
# Matches formats like 2.3.1, 2.3.1-syseleven2.0
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$/'
dependencies:
- build:gem
before_script:
- export VERSION=$(cat .version | tr -d '[:space:]')
- |
if [ "${CI_COMMIT_TAG}" != "${VERSION}" ]; then
echo "ERROR: Git tag (${CI_COMMIT_TAG}) does not match .version file (${VERSION})!"
exit 1
fi
- |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:gemstash_stage: ${GEMSTASH_STAGE_API_KEY}\n" > $HOME/.gem/credentials
script:
- echo "Pushing gem ${VERSION} to Gemstash Stage server at ${GEMSTASH_STAGE_URL}..."
- |
#!/bin/bash
set -e

GEM_FILE=$(ls *.gem)
HOST="${GEMSTASH_STAGE_URL}/private"
KEY="gemstash_stage"

echo "Pushing ${GEM_FILE} to ${HOST}..."

set +e
OUTPUT=$(gem push --verbose --key "${KEY}" --host "${HOST}" "${GEM_FILE}" 2>&1)
STATUS=$?
set -e

echo "$OUTPUT"

if [ $STATUS -ne 0 ]; then
if echo "$OUTPUT" | grep -q "500 Internal Server Error"; then
echo "NOTICE: Gemstash returned 500 - version likely already exists. Skipping push..."
exit 0
else
echo "ERROR: gem push failed unexpectedly."
exit 1
fi
fi

echo "Push successful."

publish:gem:prod:
stage: publish
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
# when: manual
dependencies:
- build:gem
before_script:
- |
export VERSION=$(cat .version | tr -d '[:space:]')
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:gemstash_prod: ${GEMSTASH_PROD_API_KEY}\n" > $HOME/.gem/credentials
script:
- echo "Pushing gem ${VERSION} to Gemstash Prod server at ${GEMSTASH_PROD_URL}..."
- |
#!/bin/bash
set -e

GEM_FILE=$(ls *.gem)
HOST="${GEMSTASH_PROD_URL}/private"
KEY="gemstash_prod"

echo "Pushing ${GEM_FILE} to ${HOST}..."

set +e
OUTPUT=$(gem push --verbose --key "${KEY}" --host "${HOST}" "${GEM_FILE}" 2>&1)
STATUS=$?
set -e

echo "$OUTPUT"

if [ $STATUS -ne 0 ]; then
if echo "$OUTPUT" | grep -q "500 Internal Server Error"; then
echo "NOTICE: Gemstash returned 500 - version likely already exists. Skipping push..."
exit 0
else
echo "ERROR: gem push failed unexpectedly."
exit 1
fi
fi

echo "Push successful."
34 changes: 14 additions & 20 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
AllCops:
TargetRubyVersion: 2.0
TargetRubyVersion: 3.1
DisplayCopNames: true

LineLength:
Max: 130
Severity: warning
NewCops: enable
SuggestExtensions: false

Style/OneLineConditional:
Enabled: true
Expand All @@ -13,10 +11,6 @@ Style/StringLiterals:
# Being consistent with Puppet
EnforcedStyle: single_quotes

# Since we're using Ruby >= 2.0 we can use the new hash syntax
Style/HashSyntax:
Enabled: true

# We are setting absurdly high limits but should work to tighten these up.
Metrics/AbcSize:
Max: 100
Expand All @@ -41,16 +35,20 @@ Metrics/PerceivedComplexity:
Max: 50
Severity: warning

# To let us use a '-' in the gem name
Naming/FileName:
Enabled: false
Naming/VariableNumber:
Enabled: false

# Indentation
CaseIndentation:
Layout/CaseIndentation:
IndentOneStep: false

Lint/EndAlignment:
Layout/EndAlignment:
EnforcedStyleAlignWith: variable

# To let us use a '-' in the gem name
Style/FileName:
Enabled: false
Layout/LineLength:
Max: 130
Severity: warning

# Sometimes it's cleaner without this
Style/Documentation:
Expand All @@ -61,8 +59,6 @@ Style/FormatStringToken:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/VariableNumber:
Enabled: false
Security/YAMLLoad:
Enabled: false
Lint/AmbiguousBlockAssociation:
Expand All @@ -81,7 +77,5 @@ Layout/HeredocIndentation:
Enabled: false
Layout/ExtraSpacing:
Enabled: false
Performance/Caller:
Enabled: false
Style/WordArray:
Enabled: false
Loading