-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ef82f0f
Showing
21 changed files
with
638 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
# Created by https://www.toptal.com/developers/gitignore/api/ruby,jetbrains+all,visualstudiocode | ||
# Edit at https://www.toptal.com/developers/gitignore?templates=ruby,jetbrains+all,visualstudiocode | ||
|
||
### JetBrains+all ### | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# AWS User-specific | ||
.idea/**/aws.xml | ||
|
||
# Generated files | ||
.idea/**/contentModel.xml | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/artifacts | ||
# .idea/compiler.xml | ||
# .idea/jarRepositories.xml | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
*.iml | ||
# *.ipr | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# SonarLint plugin | ||
.idea/sonarlint/ | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests | ||
|
||
# Android studio 3.1+ serialized cache file | ||
.idea/caches/build_file_checksums.ser | ||
|
||
### JetBrains+all Patch ### | ||
# Ignore everything but code style settings and run configurations | ||
# that are supposed to be shared within teams. | ||
|
||
.idea/* | ||
|
||
!.idea/codeStyles | ||
!.idea/runConfigurations | ||
|
||
### Ruby ### | ||
*.gem | ||
*.rbc | ||
/.config | ||
/coverage/ | ||
/InstalledFiles | ||
/pkg/ | ||
/spec/reports/ | ||
/spec/examples.txt | ||
/test/tmp/ | ||
/test/version_tmp/ | ||
/tmp/ | ||
|
||
# Used by dotenv library to load environment variables. | ||
# .env | ||
|
||
# Ignore Byebug command history file. | ||
.byebug_history | ||
|
||
## Specific to RubyMotion: | ||
.dat* | ||
.repl_history | ||
build/ | ||
*.bridgesupport | ||
build-iPhoneOS/ | ||
build-iPhoneSimulator/ | ||
|
||
## Specific to RubyMotion (use of CocoaPods): | ||
# | ||
# We recommend against adding the Pods directory to your .gitignore. However | ||
# you should judge for yourself, the pros and cons are mentioned at: | ||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||
# vendor/Pods/ | ||
|
||
## Documentation cache and generated files: | ||
/.yardoc/ | ||
/_yardoc/ | ||
/doc/ | ||
/rdoc/ | ||
|
||
## Environment normalization: | ||
/.bundle/ | ||
/vendor/bundle | ||
/lib/bundler/man/ | ||
|
||
# for a library or gem, you might want to ignore these files since the code is | ||
# intended to run in multiple environments; otherwise, check them in: | ||
# Gemfile.lock | ||
# .ruby-version | ||
# .ruby-gemset | ||
|
||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc | ||
|
||
# Used by RuboCop. Remote config files pulled in from inherit_from directive. | ||
# .rubocop-https?--* | ||
|
||
### VisualStudioCode ### | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
!.vscode/*.code-snippets | ||
|
||
# Local History for Visual Studio Code | ||
.history/ | ||
|
||
# Built Visual Studio Code Extensions | ||
*.vsix | ||
|
||
### VisualStudioCode Patch ### | ||
# Ignore all local history of files | ||
.history | ||
.ionide | ||
|
||
# End of https://www.toptal.com/developers/gitignore/api/ruby,jetbrains+all,visualstudiocode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
AllCops: | ||
NewCops: enable | ||
|
||
Metrics/AbcSize: | ||
Enabled: false | ||
|
||
Metrics/MethodLength: | ||
Enabled: false | ||
|
||
Naming/BlockForwarding: | ||
Enabled: false | ||
|
||
Naming/MethodParameterName: | ||
Enabled: false | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Style/HashSyntax: | ||
EnforcedShorthandSyntax: never | ||
|
||
Style/TrailingCommaInHashLiteral: | ||
EnforcedStyleForMultiline: comma |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ruby:3.2.0-bullseye | ||
|
||
WORKDIR /gitlab_pipeline_action | ||
COPY Gemfile Gemfile.lock ./ | ||
RUN bundle install | ||
COPY bin/ bin/ | ||
COPY lib/ lib/ | ||
|
||
ENV BUNDLE_GEMFILE=/gitlab_pipeline_action/Gemfile | ||
ENTRYPOINT ["bundle", "exec", "ruby", "/gitlab_pipeline_action/bin/gitlab_pipeline_action.rb"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'gitlab', '~> 4.19' | ||
|
||
gem 'git', '~> 1.18' | ||
|
||
gem 'rubocop', '~> 1.57' | ||
|
||
gem 'docker-api', '~> 2.2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
addressable (2.8.5) | ||
public_suffix (>= 2.0.2, < 6.0) | ||
ast (2.4.2) | ||
docker-api (2.2.0) | ||
excon (>= 0.47.0) | ||
multi_json | ||
excon (0.104.0) | ||
git (1.18.0) | ||
addressable (~> 2.8) | ||
rchardet (~> 1.8) | ||
gitlab (4.19.0) | ||
httparty (~> 0.20) | ||
terminal-table (>= 1.5.1) | ||
httparty (0.21.0) | ||
mini_mime (>= 1.0.0) | ||
multi_xml (>= 0.5.2) | ||
json (2.6.3) | ||
language_server-protocol (3.17.0.3) | ||
mini_mime (1.1.5) | ||
multi_json (1.15.0) | ||
multi_xml (0.6.0) | ||
parallel (1.23.0) | ||
parser (3.2.2.4) | ||
ast (~> 2.4.1) | ||
racc | ||
public_suffix (5.0.3) | ||
racc (1.7.3) | ||
rainbow (3.1.1) | ||
rchardet (1.8.0) | ||
regexp_parser (2.8.2) | ||
rexml (3.2.6) | ||
rubocop (1.57.2) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
parallel (~> 1.10) | ||
parser (>= 3.2.2.4) | ||
rainbow (>= 2.2.2, < 4.0) | ||
regexp_parser (>= 1.8, < 3.0) | ||
rexml (>= 3.2.5, < 4.0) | ||
rubocop-ast (>= 1.28.1, < 2.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (>= 2.4.0, < 3.0) | ||
rubocop-ast (1.30.0) | ||
parser (>= 3.2.1.0) | ||
ruby-progressbar (1.13.0) | ||
terminal-table (3.0.2) | ||
unicode-display_width (>= 1.1.1, < 3) | ||
unicode-display_width (2.5.0) | ||
|
||
PLATFORMS | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
docker-api (~> 2.2) | ||
git (~> 1.18) | ||
gitlab (~> 4.19) | ||
rubocop (~> 1.57) | ||
|
||
BUNDLED WITH | ||
2.4.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: 'GitLab Pipeline Action' | ||
description: 'Run a GitLab pipeline from within GitHub actions' | ||
inputs: | ||
GL_SERVER_URL: | ||
description: 'Host of the GitLab server' | ||
required: true | ||
default: 'https://gitlab.com' | ||
GL_PROJECT_ID: | ||
description: 'ID of the GitLab project' | ||
required: true | ||
GL_RUNNER_TOKEN: | ||
description: 'A runner token, if a runner should be started in this action' | ||
GL_API_TOKEN: | ||
description: 'A token to check the pipeline status with. Required if the project is private' | ||
author: 'Taucher2003' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
lib = File.expand_path('../lib', __dir__) | ||
|
||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
|
||
require 'gitlab_pipeline_action' | ||
|
||
exit GitlabPipelineAction::Entrypoint.new.execute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
module GitlabPipelineAction | ||
class Context | ||
attr_accessor :gh_project, :gh_sha, :gh_ref, :gh_server_url, | ||
:gl_server_url, :gl_project_id, :gl_project_path, :gl_runner_token, | ||
:gl_api_token, :gl_pipeline, | ||
:git_repository, :git_path, | ||
:gitlab_client, | ||
:docker_runner_container | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
module GitlabPipelineAction | ||
class Entrypoint | ||
STEPS = [ | ||
GitlabPipelineAction::Step::PrepareContext, | ||
GitlabPipelineAction::Step::FetchData, | ||
GitlabPipelineAction::Step::CloneProject, | ||
GitlabPipelineAction::Step::PushBranchToGitlab, | ||
GitlabPipelineAction::Step::TriggerPipeline, | ||
GitlabPipelineAction::Step::StartRunner, | ||
GitlabPipelineAction::Step::WaitForPipeline, | ||
GitlabPipelineAction::Step::StopRunner, | ||
GitlabPipelineAction::Step::RemoveBranchFromGitlab | ||
].freeze | ||
|
||
def execute | ||
context = Context.new | ||
STEPS.each do |step_class| | ||
step = step_class.new(context) | ||
print "#{step_class}: " | ||
|
||
if step.skip? | ||
puts 'skipped' | ||
next | ||
end | ||
puts 'starting' | ||
|
||
start_time = Time.now.to_i | ||
step.execute | ||
end_time = Time.now.to_i | ||
|
||
puts "#{step_class}: done (#{end_time - start_time}s)" | ||
end | ||
|
||
context.gl_pipeline.status == 'success' ? 0 : 1 | ||
end | ||
end | ||
end |
Oops, something went wrong.