-
Notifications
You must be signed in to change notification settings - Fork 128
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
1 parent
189f384
commit b83dea9
Showing
11 changed files
with
1,142 additions
and
12 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,61 @@ | ||
##============================================================================ | ||
## Copyright (c) Kitware, Inc. | ||
## All rights reserved. | ||
## See LICENSE.txt for details. | ||
## | ||
## This software is distributed WITHOUT ANY WARRANTY; without even | ||
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR | ||
## PURPOSE. See the above copyright notice for more information. | ||
##============================================================================ | ||
|
||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR) | ||
|
||
set(version 4.6.1) | ||
set(arch x86_64) | ||
|
||
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") | ||
set(sha256sum da1e1781bc1c4b019216fa16391af3e1daaee7e7f49a8ec9b0cdc8a1d05c50e2) | ||
set(base_url https://github.com/ccache/ccache/releases/download) | ||
set(platform linux) | ||
set(extension tar.xz) | ||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") | ||
set(sha256sum 3e36ba8c80fbf7f2b95fe0227b9dd1ca6143d721aab052caf0d5729769138059) | ||
set(full_url https://gitlab.kitware.com/utils/ci-utilities/-/package_files/534/download) | ||
set(filename ccache) | ||
set(extension tar.gz) | ||
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") | ||
set(sha256sum a6c6311973aa3d2aae22424895f2f968e5d661be003b25f1bd854a5c0cd57563) | ||
set(base_url https://github.com/ccache/ccache/releases/download) | ||
set(platform windows) | ||
set(extension zip) | ||
else() | ||
message(FATAL_ERROR "Unrecognized platform ${CMAKE_HOST_SYSTEM_NAME}") | ||
endif() | ||
|
||
if(NOT DEFINED filename) | ||
set(filename "ccache-${version}-${platform}-${arch}") | ||
endif() | ||
|
||
set(tarball "${filename}.${extension}") | ||
|
||
if(NOT DEFINED full_url) | ||
set(full_url "${base_url}/v${version}/${tarball}") | ||
endif() | ||
|
||
file(DOWNLOAD | ||
"${full_url}" $ENV{CCACHE_INSTALL_DIR}/${tarball} | ||
EXPECTED_HASH SHA256=${sha256sum} | ||
SHOW_PROGRESS | ||
) | ||
|
||
execute_process( | ||
COMMAND ${CMAKE_COMMAND} -E tar xf ${tarball} | ||
WORKING_DIRECTORY $ENV{CCACHE_INSTALL_DIR} | ||
RESULT_VARIABLE extract_results | ||
) | ||
|
||
if(extract_results) | ||
message(FATAL_ERROR "Extracting `${tarball}` failed: ${extract_results}.") | ||
endif() | ||
|
||
file(RENAME $ENV{CCACHE_INSTALL_DIR}/${filename} $ENV{CCACHE_INSTALL_DIR}/ccache) |
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,8 @@ | ||
child_pipeline_{branch}: | ||
variables: | ||
CUSTOM_CI_BUILDS_DIR: "/lustre/orion/csc303/scratch/vbolea/ci/adios2/runtime" | ||
trigger: | ||
include: | ||
- project: 'ci/csc303_crusher/dev/adios2' | ||
ref: '{branch}' | ||
file: '.gitlab/gitlab-ci-crusher.yml' |
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,65 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Distributed under the OSI-approved Apache License, Version 2.0. See | ||
# accompanying file Copyright.txt for details. | ||
# | ||
# generate_pipeline.py | ||
# | ||
# Created: May 19, 2023 | ||
# Author: Vicente Adolfo Bolea Sanchez <vicente.bolea@kitware.com> | ||
|
||
from datetime import datetime | ||
import argparse | ||
import requests | ||
import time | ||
# Remove annyoing insecure warning | ||
import urllib3 | ||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
|
||
|
||
def is_date_after(date, days): | ||
deadline_sec = int(time.time()) - (days * 86400) | ||
utc_dt = datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ') | ||
timestamp_sec = (utc_dt - datetime(1970, 1, 1)).total_seconds() | ||
return timestamp_sec > deadline_sec | ||
|
||
|
||
def request_dict(url): | ||
r = requests.get(url, verify=False) | ||
return r.json() | ||
|
||
|
||
parser = argparse.ArgumentParser( | ||
prog='generate_pipeline.py', | ||
description='Generate Dynamic pipelines for Gitlab') | ||
parser.add_argument( | ||
'-u', '--url', required=True, | ||
help='Base URL for Gitlab remote. Ex: https://code.olcf.ornl.gov/') | ||
parser.add_argument( | ||
'-p', '--project_id', required=True, | ||
help='Gitlab internal project ID of the project.') | ||
parser.add_argument( | ||
'-d', '--days', type=int, default=1, | ||
help='How many days back to search for commits') | ||
parser.add_argument( | ||
'-m', '--max', type=int, default=3, | ||
help='Maximum amount of pipelines computed') | ||
parser.add_argument( | ||
'-f', '--template_file', required=True, | ||
help='Template file of the pipeline `{branch}` will be substituted') | ||
args = parser.parse_args() | ||
|
||
with open(args.template_file, "r") as fd: | ||
template_str = fd.read() | ||
url = args.url + "/api/v4/projects/" + str(args.project_id) | ||
branches = request_dict(url + "/repository/branches") | ||
num_pipeline = 0 | ||
for branch in branches: | ||
# Convert to ISO 8601 date format. | ||
date_stamp = branch['commit']['committed_date'].split('.')[0] + "Z" | ||
if num_pipeline < args.max and is_date_after(date_stamp, args.days): | ||
commit_sha = branch['commit']['id'] | ||
commit = request_dict(url + "/repository/commits/" + commit_sha) | ||
if commit['status'] is None: | ||
num_pipeline += 1 | ||
print(template_str.format(branch=branch['name'])) |
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
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
Oops, something went wrong.