Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
gershomb
GHC
Commits
acf2129d
Commit
acf2129d
authored
6 years ago
by
Ben Gamari
Browse files
Options
Downloads
Patches
Plain Diff
gitlab-ci: Implement head.hackage jobs
parent
b8326897
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+39
-0
39 additions, 0 deletions
.gitlab-ci.yml
.gitlab/start-head.hackage.sh
+79
-0
79 additions, 0 deletions
.gitlab/start-head.hackage.sh
with
118 additions
and
0 deletions
.gitlab-ci.yml
+
39
−
0
View file @
acf2129d
...
...
@@ -17,6 +17,7 @@ stages:
-
full-build
-
cleanup
# See Note [Cleanup on Windows]
-
packaging
-
hackage
############################################################
# Runner Tags
...
...
@@ -577,3 +578,41 @@ source-tarball:
-
make sdist
-
mv sdistprep/*.xz .
-
make show VALUE=version > version
############################################################
# Testing via head.hackage
############################################################
# Triggering jobs in the ghc/head.hackage project requires that we have a job
# token for that repository. Furthermore the head.hackage CI job must have
# access to an unprivileged access token with the ability to query the ghc/ghc
# project such that it can find the job ID of the fedora27 job for the current
# pipeline.
.hackage
:
stage
:
hackage
image
:
ghcci/x86_64-linux-deb9:0.2
tags
:
-
x86_64-linux
dependencies
:
[]
variables
:
HEAD_HACKAGE_PROJECT_ID
:
"
78"
script
:
-
bash .gitlab/start-head.hackage.sh
hackage
:
extends
:
.hackage
when
:
manual
hackage-label
:
extends
:
.hackage
only
:
variables
:
-
$CI_MERGE_REQUEST_LABELS =~ /.*user-facing.*/
nightly-hackage
:
extends
:
.hackage
only
:
variables
:
-
$NIGHTLY
This diff is collapsed.
Click to expand it.
.gitlab/start-head.hackage.sh
0 → 100644
+
79
−
0
View file @
acf2129d
#!/usr/bin/env bash
set
-e
# Start a head.hackage job and wait for completion. Expected to be called from
# GitLab CI.
if
[
-z
"
$HEAD_HACKAGE_TRIGGER_TOKEN
"
]
;
then
echo
"Error: Expected head.hackage trigger token in HEAD_HACKAGE_TRIGGER_TOKEN"
exit
1
fi
if
[
-z
"
$CI_PIPELINE_ID
"
]
;
then
echo
"Error: Expected pipeline id in CI_PIPELINE_ID"
exit
1
fi
if
[
-z
"
$HEAD_HACKAGE_PROJECT_ID
"
]
;
then
HEAD_HACKAGE_PROJECT_ID
=
"78"
fi
# Start pipeline
curl
--silent
--show-error
\
--request
POST
\
-F
"token=
$HEAD_HACKAGE_TRIGGER_TOKEN
"
\
-F
"ref=gitlab-ci-nix"
\
-F
"variables[GHC_PIPELINE_ID]=
$CI_PIPELINE_ID
"
\
https://gitlab.haskell.org/api/v4/projects/
$HEAD_HACKAGE_PROJECT_ID
/trigger/pipeline
\
|
tee
resp.json
echo
pipeline_id
=
$(
jq .id < resp.json
)
url
=
$(
jq .web_url < resp.json
)
echo
echo
"Started head.hackage pipeline
$pipeline_id
:
$url
"
# Wait for completion
running
=
echo
"Waiting for build to complete..."
while
true
;
do
sleep
10
curl
--silent
--show-error
\
--request
GET
\
-F
"job_token=
$CI_JOB_TOKEN
"
\
https://gitlab.haskell.org/api/v4/projects/
$HEAD_HACKAGE_PROJECT_ID
/pipelines/
$pipeline_id
\
>
resp.json
status
=
$(
jq .status < resp.json
)
case
$status
in
"
\"
pending
\"
"
)
;;
"
\"
running
\"
"
)
if
[
-z
"
$running
"
]
;
then
echo
"Pipeline
$pipeline_id
is now running."
running
=
1
fi
;;
"
\"
success
\"
"
)
echo
"Pipeline
$pipeline_id
finished successfully."
exit
0
;;
"
\"
failed
\"
"
)
echo
"Pipeline
$pipeline_id
failed."
exit
1
;;
"
\"
canceled
\"
"
)
echo
"Pipeline
$pipeline_id
was canceled."
exit
1
;;
"
\"
skipped
\"
"
)
echo
"Pipeline
$pipeline_id
was skipped."
exit
1
;;
*
)
cat
resp.json
echo
"Error: Unknown pipeline status
$status
"
exit
2
;;
esac
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment